浏览代码

Add GLSL comments to explain the math a bit

Arseny Kapoulkine 5 年之前
父节点
当前提交
40f015ffaf

+ 3 - 0
src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js

@@ -1,6 +1,9 @@
 export default /* glsl */`
 #ifdef USE_MORPHNORMALS
 
+	// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
+	// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)
+	// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
 	objectNormal *= morphTargetBaseInfluence;
 	objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
 	objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];

+ 3 - 0
src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js

@@ -1,6 +1,9 @@
 export default /* glsl */`
 #ifdef USE_MORPHTARGETS
 
+	// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
+	// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)
+	// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
 	transformed *= morphTargetBaseInfluence;
 	transformed += morphTarget0 * morphTargetInfluences[ 0 ];
 	transformed += morphTarget1 * morphTargetInfluences[ 1 ];