Conversation
j9liu
left a comment
There was a problem hiding this comment.
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.
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.
@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 <32226860+j9liu@users.noreply.github.com>
Co-authored-by: Janine Liu <32226860+j9liu@users.noreply.github.com>

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).