瀏覽代碼

ShaderChunk: Fixed transmission crash when using flat shading (#21897)

Mr.doob 4 年之前
父節點
當前提交
5be5267542
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js

+ 1 - 2
src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js

@@ -16,7 +16,6 @@ export default /* glsl */`
 	vec3 pos = vWorldPosition.xyz / vWorldPosition.w;
 	vec3 v = normalize( cameraPosition - pos );
 	vec3 viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
-	vec3 n = normalize( vNormal );
 	float ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );
 
 	// From https://google.github.io/filament/Filament.html#materialsystem/parameterization/remapping
@@ -24,7 +23,7 @@ export default /* glsl */`
 	vec3 f90 = vec3( 1.0 );
 
 	vec3 f_transmission = totalTransmission * getIBLVolumeRefraction(
-		n, v, viewDir, roughnessFactor, diffuseColor.rgb, f0, f90,
+		normal, v, viewDir, roughnessFactor, diffuseColor.rgb, f0, f90,
 		pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,
 		attenuationColor, attenuationDistance);