Browse Source

Merge pull request #16260 from WestLangley/dev-light_probe_color

LightProbe: modulate irradiance by probe color
Mr.doob 6 years ago
parent
commit
4a222c9875
2 changed files with 7 additions and 2 deletions
  1. 1 1
      src/lights/LightProbe.js
  2. 6 1
      src/renderers/webgl/WebGLLights.js

+ 1 - 1
src/lights/LightProbe.js

@@ -16,7 +16,7 @@ function LightProbe( color, intensity ) {
 
 
 	this.sh = new SphericalHarmonics3();
 	this.sh = new SphericalHarmonics3();
 
 
-	this.sh.coefficients[ 0 ].set( this.color.r, this.color.g, this.color.b );
+	this.sh.coefficients[ 0 ].set( 1, 1, 1 );
 
 
 	this.type = 'LightProbe';
 	this.type = 'LightProbe';
 
 

+ 6 - 1
src/renderers/webgl/WebGLLights.js

@@ -176,7 +176,12 @@ function WebGLLights() {
 
 
 				for ( var j = 0; j < 9; j ++ ) {
 				for ( var j = 0; j < 9; j ++ ) {
 
 
-					state.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );
+					var probe = state.probe[ j ];
+					var coeff = light.sh.coefficients[ j ];
+
+					probe.x += coeff.x * color.r * intensity;
+					probe.y += coeff.y * color.g * intensity;
+					probe.z += coeff.z * color.b * intensity;
 
 
 				}
 				}