2
0

morphnormal_vertex.glsl.js 641 B

12345678910111213141516
  1. export default /* glsl */`
  2. #ifdef USE_MORPHNORMALS
  3. // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
  4. // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)
  5. // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
  6. objectNormal *= morphTargetBaseInfluence;
  7. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  8. if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
  9. }
  10. #endif
  11. `;