-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Use BLEND_SHAPE_MODE_RELATIVE
for GLTF blend shape
#60814
Use BLEND_SHAPE_MODE_RELATIVE
for GLTF blend shape
#60814
Conversation
55b411a
to
254314a
Compare
(Converted to draft because this doesn't work well with |
254314a
to
f1819cc
Compare
Effectively undo godotengine#24647 (and godotengine#20377 it was fixing is no longer a issue since vertex weight in skeleton is now separate) and fixes godotengine#55812 where the issue might total weight not normalized as expected under BLEND_SHAPE_MODE_NORMALIZED. Note the behavior for blending multiple blend shapes will change from "average" to "additive".
4666a26
to
f2cdab5
Compare
BLEND_SHAPE_MODE_RELATIVE
for GLTF blend shape
Pending review. |
I see that #24647 added some code which is still present in the current importer, and this new PR is adding more code to do conversions later on. I'm not familiar with that code but just wanted to check that this is intended and not doing conversions twice back and forth. |
Yes, it is intended. My previous change actually just undid #24647 (254314a), so it made the blend shape store delta in the first place again. However, I found that would regress #19346 , and after a bit debugging i found the mikktspace generation code wants full positions and normals to be able to generate tangents correctly, otherwise it would get stuck by the mesh in #19346. So I made it store full vertices first, then after generating tangent space, substract original values to get offset again with new generated tangent space. This works for the mesh in #19346. Also had a comment in code about this. |
I am not sure what is going on here, but I see no reason to store these as relative, since tangent and bitangent would not be stored properly. |
Hi @reduz , can you elaborate on how tangent and bitangent is wrong? This change will store the tangent as offset after generating tangent space (and i looked and found that flip component (w) isn't used for blend shape blending in shaders). And bitangent is recalculated from normal and tangent in shader after blending. (Though i know this is not mathematically precise unless we regenerate tangent space after blending, it is good enough in my opinion, and what happened before with storing whole vertices in blend shapes and use The whole reason I am changing it back to |
Effectively undo #24647 (and #20377 it was fixing is no longer an issue since vertex weight in skeleton is now separate) and fixes #55812 where the total weight might not be normalized as expected under
BLEND_SHAPE_MODE_NORMALIZED
.Note the behavior for blending multiple blend shapes will change from "average" to "additive".
Tested with the models from both #20377 and #55812 and both seems to behave correctly
Note this doesn't fix normal behaving weird when using
BLEND_SHAPE_MODE_NORMALIZED
(which my guess is final total weight not normalized to 1 before sending to renderer?), but instead just useBLEND_SHAPE_MODE_RELATIVE
that now behaves correctly