bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.36k stars 3.59k forks source link

Prepass normals lack precision #9264

Open DGriffin91 opened 1 year ago

DGriffin91 commented 1 year ago

Bevy version a879f98

The prepass normals appear to lack precision. Not sure if it's a limitation of the prepass normals format, 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 for images below. Version for testing with Deferred Rendering PR.

Normals without prepass: forward

Normals with prepass: prepass_normals

Normals using oct24 format from Deferred Rendering PR deferred

JMS55 commented 1 year ago

Any reason we don't just oct24 encode the prepass normals?

DGriffin91 commented 1 year ago

Not that I know of. Seems like it should work nicely. Depending on the texture format I guess it's likely that we'll have 32 bits so we'd have some left over or we could just use oct32.