sebavan 6 rokov pred
rodič
commit
6cc0a86991

+ 9 - 4
src/Maths/sphericalPolynomial.ts

@@ -288,6 +288,11 @@ export class SphericalHarmonics {
         result.l21 = polynomial.zx.scale(1.16538);
         result.l22 = polynomial.xx.scale(1.16538).subtract(polynomial.yy.scale(1.16538));
 
+        result.l1_1.scaleInPlace(-1);
+        result.l11.scaleInPlace(-1);
+        result.l2_1.scaleInPlace(-1);
+        result.l21.scaleInPlace(-1);
+
         result.scaleInPlace(Math.PI);
 
         return result;
@@ -394,16 +399,16 @@ export class SphericalPolynomial {
         var result = new SphericalPolynomial();
         result._harmonics = harmonics;
 
-        result.x = harmonics.l11.scale(1.02333);
-        result.y = harmonics.l1_1.scale(1.02333);
+        result.x = harmonics.l11.scale(1.02333).scale(-1);
+        result.y = harmonics.l1_1.scale(1.02333).scale(-1);
         result.z = harmonics.l10.scale(1.02333);
 
         result.xx = harmonics.l00.scale(0.886277).subtract(harmonics.l20.scale(0.247708)).add(harmonics.l22.scale(0.429043));
         result.yy = harmonics.l00.scale(0.886277).subtract(harmonics.l20.scale(0.247708)).subtract(harmonics.l22.scale(0.429043));
         result.zz = harmonics.l00.scale(0.886277).add(harmonics.l20.scale(0.495417));
 
-        result.yz = harmonics.l2_1.scale(0.858086);
-        result.zx = harmonics.l21.scale(0.858086);
+        result.yz = harmonics.l2_1.scale(0.858086).scale(-1);
+        result.zx = harmonics.l21.scale(0.858086).scale(-1);
         result.xy = harmonics.l2_2.scale(0.858086);
 
         result.scaleInPlace(1.0 / Math.PI);

+ 2 - 2
src/Shaders/pbr.fragment.fx

@@ -496,7 +496,7 @@ void main(void) {
                     irradianceVector.z *= -1.0;
                 #endif
 
-                environmentIrradiance = environmentIrradiance(irradianceVector);
+                environmentIrradiance = computeEnvironmentIrradiance(irradianceVector);
             #endif
         #endif
 
@@ -981,7 +981,7 @@ void main(void) {
             #endif
         #endif
 
-        vec3 refractionIrradiance = environmentIrradiance(-irradianceVector);
+        vec3 refractionIrradiance = computeEnvironmentIrradiance(-irradianceVector);
         refractionIrradiance *= transmittance;
     #endif
 

+ 1 - 1
src/Shaders/pbr.vertex.fx

@@ -195,7 +195,7 @@ void main(void) {
         #ifdef REFLECTIONMAP_OPPOSITEZ
             reflectionVector.z *= -1.0;
         #endif
-        vEnvironmentIrradiance = environmentIrradiance(reflectionVector);
+        vEnvironmentIrradiance = computeEnvironmentIrradiance(reflectionVector);
     #endif
 #endif
 

BIN
tests/validation/ReferenceImages/highlights.png


BIN
tests/validation/ReferenceImages/simulatePointer.png