Skip to content
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

Generate smooth normals when normals are missing #133

Merged
merged 1 commit into from
Nov 29, 2022
Merged

Conversation

nithinp7
Copy link
Contributor

Previously we did not always generate normals when they were missing. Presumably Unity was generating normals for us in that case but potentially gets confused with the model transform we give our tiles. In particular, Unity and glTF have opposite handedness - while the conversion between the two is still possible in the form of a matrix, Unity only provides us the ability to individually set translation, rotation, and scale. The only workaround then, was to invert the change-of-handedness matrix to make it a valid rotation matrix, and use a negative scale so the handedness would be corrected in the final matrix.

Unfortunately, it seems like Unity may have been using the rotation without the scale when auto-generating normals for our tiles (after all one would think scale shouldn't affect rotation!). After this change, we always generate smooth normals in Cesium Native when normals are missing - so it is no longer an option on the tileset.

@kring kring merged commit dfaa17e into main Nov 29, 2022
@kring kring deleted the smooth-normals branch November 29, 2022 04:18
@kring
Copy link
Member

kring commented Nov 29, 2022

Thanks @nithinp7!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants