Explorar o código

Decouple light probe irradiance from other indirect light sources

WestLangley %!s(int64=6) %!d(string=hai) anos
pai
achega
f3bfd1af57

+ 1 - 1
src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js

@@ -7,7 +7,7 @@ export default /* glsl */`
 
 #if defined( RE_IndirectSpecular )
 
-	RE_IndirectSpecular( radiance, irradiance, clearcoatRadiance, geometry, material, reflectedLight );
+	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
 
 #endif
 `;

+ 3 - 1
src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js

@@ -15,9 +15,11 @@ export default /* glsl */`
 
 	#endif
 
+	vec3 iblIrradiance = vec3( 0.0 );
+
 	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
 
-		irradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel );
+		iblIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel );
 
 	#endif
 

+ 1 - 0
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js

@@ -117,6 +117,7 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC
 
 void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
 
+	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
 
 }