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

Fix glTF tangent space computation, and fix default normal texture #75

Merged
merged 1 commit into from
Oct 9, 2020

Conversation

kring
Copy link
Member

@kring kring commented Oct 9, 2020

So the normals are right.

The main problem was that glTF super-material always applies a normal texture, even when the glTF doesn't have one, and the default 1x1 normal texture I was using did not have the normal pointing correctly in the +Z direction.

Also added code to compute flat normals for meshes that don't have any (as specified by the glTF spec), and to use MikkTSpace to compute the tangent and bi-tangent (again as specified by glTF) for meshes without tangents.

One downside to this PR is we're now duplicating every vertex for each face that it's in (i.e. not making use of an indexed triangle list). This could definitely be more efficient.

Fixes #3

@kring kring merged commit f6d9972 into master Oct 9, 2020
@kring kring deleted the normals branch October 9, 2020 10:41
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.

Generate normals, tangents, and bitangents according to glTF spec
1 participant