bevyengine / bevyengine/bevy

Prepass normals lack precision

Open
#9,264 2 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version [a879f98](https://github.com/bevyengine/bevy/commit/a879f98d3b757fe19afb17b976b11f49119ab900)

The prepass normals appear to lack precision. Not sure if it's a limitation of the [prepass normals format](https://github.com/bevyengine/bevy/blob/main/crates/bevy_core_pipeline/src/prepass/mod.rs#L42), or something else.

This is a helpful paper regarding formats for normals: https://jcgt.org/published/0003/02/01/paper.pdf
Unfortunately, it doesn't have an image of RGB10A2, but in a table it does list snorm10×3, which may be similar.

[Test scene](https://gist.github.com/DGriffin91/502ab6b6baa3e2cfff3e85b85ae1019d) for images below. [Version for testing](https://gist.github.com/DGriffin91/232da7eca8cf819c1478cb3053cd5079) with [Deferred Rendering PR](https://github.com/bevyengine/bevy/pull/9258).

Normals without prepass:
![forward](https://github.com/bevyengine/bevy/assets/33357138/cacfa7be-cdad-41ee-b484-8c0a7d016329)

Normals with prepass:
![prepass_normals](https://github.com/bevyengine/bevy/assets/33357138/6217b618-e195-4441-b094-4886753c9043)

Normals using oct24 format from [Deferred Rendering PR](https://github.com/bevyengine/bevy/pull/9258)
![deferred](https://github.com/bevyengine/bevy/assets/33357138/99646759-2f99-461e-9dac-612518ab849c)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.