2
$\begingroup$

I am trying to verify that if I have my inNormal and some N amount of morph normals that I would want to do something such as

outNormal = vec3(inNormal);
outNormal += morphNormal0 * morphWeight0;
outNormal += morphNormal1 * morphWeight1;
...
outNormal += morphNormalN * morphWeightN;

This seems to work for me (don't have a ground truth to compare) so I wanted to test it in Three.js knowing it would have an established method and I see they use

objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];

So now I am wondering how that math works out as it doesn't work for me. Both methods end up multiplying it by a normalMatrixso not sure what would be different.

edit: Assuming both are loading in glTF 2.0 models

$\endgroup$
3
  • $\begingroup$ In your method, is morphNormalN a delta or the actual normal to morph towards? $\endgroup$
    – bram0101
    May 15, 2018 at 14:57
  • $\begingroup$ @bram0101 the spec says "deviations in the Morph Target" and looking at the data it looks like morphNormal0 a delta, not the "new normal" of the morph target position $\endgroup$ May 15, 2018 at 19:58
  • $\begingroup$ Actually I realized I never checked if they altered the morphNormals prior to this $\endgroup$ May 15, 2018 at 20:05

1 Answer 1

1
$\begingroup$

It would seem that, in the second example, the morphNormals are targets while in in the first they are deltas.

This explains the difference in math used between the two pieces of code.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.