-
Notifications
You must be signed in to change notification settings - Fork 103
Import tangents #613
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: flip-textures-and-uvs
Are you sure you want to change the base?
Import tangents #613
Conversation
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! Still waiting on my slow machine to build so I can actually try this out, but I'll leave some comments in the meantime.
| *reinterpret_cast<Vector3*>(pWritePos) = positionView[vertexIndex]; | ||
| pWritePos += sizeof(Vector3); | ||
|
|
||
| if (computeFlatNormals) { |
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.
Hm I'm not sure how much of an impact it has here, but we tend to avoid putting if statements in a loop body if possible. I know in Unreal we prefer to use near-identical for loops if it can avoid a few if statements mid-loop. Maybe others have an opinion?
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.
@j9liu Hmm. Not sure I see the benefit here. The existing implementation already had if for vertex colors and normals. To completely get rid of the conditionals, we'd need 8 nearly-identical permutations of this loop.
|
@david-lively Forgot that you mentioned you need to fix the material, so I'll put this on draft until that is fixed. (Otherwise we have model-provided tangents with a faulty appearance...)
|
Co-authored-by: Janine Liu <[email protected]>
Co-authored-by: Janine Liu <[email protected]>

Description
Previously, the glTF importer would ignore tangents in the model. This PR ensure that tangents in the vertex stream are properly imported and transferred to the relevant vertex buffer.
(This depends on #611 so merge that first.)
Author checklist
CHANGES.mdwith a short summary of my change (for user-facing changes).Testing plan
Load a glTF that includes tangents, such as the glTF Normal Tangent Mirror Test.
In Unity's Render Debugger, activate the Tangent material override and verify that tangents are included.
By default, Unity provides
(1,0,0)for tangents if they are missing. The tangent vertex attribute override should show something other than(1,0,0).