Selaa lähdekoodia

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

Mr.doob 4 vuotta sitten
vanhempi
commit
5be5267542

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

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