-
Notifications
You must be signed in to change notification settings - Fork 97
Generate face normals in pixel shader #596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…esiumGS/cesium-unity into calculate-flat-normals-in-pixel-shader
… from glTF normal map.
Removed an extraneous semicolon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @david-lively! I still have to test this on my own end, but I took a look through the code so I could get feedback to you sooner than later. No major changes, just some cleanup + word tweak suggestions ^^
@david-lively I'm going to move this out of the September release because I think you're still working on it, and it's not critical to the release. |
The glTF 2.0 specification requires that flat normals are generated when they are missing from the source data.
This PR modifies the
CesiumDefaultTilesetShader
to optionally generate face normals in the pixel shader. This is more space-efficient than the previous approach of duplicating vertices. The new boolean shader uniform,computeFlatNormals
controls this behavior.This feature will be enabled when all of these conditions are true:
Generate Smooth Normals
is not enabledCesium3DTileset.ignoreKhrMaterialsUnlit
istrue
.Note that any custom material that previously relied on CPU-generated flat normals should be updated to use the new feature. In
CesiumDefaultTilesetShader
, the necessary Shader Graph block is imlemented like so: