sebavan před 6 roky
rodič
revize
849411a53e

+ 9 - 9
src/Maths/sphericalPolynomial.ts

@@ -38,17 +38,17 @@ import { Nullable } from "../types";
 //                         l - m
 //                         l - m
 // Leaving the trigonometric terms aside we can precompute the constants to :
 // Leaving the trigonometric terms aside we can precompute the constants to :
 const SH3ylmBasisConstants = [
 const SH3ylmBasisConstants = [
-    Math.sqrt(1  /  (4 * Math.PI)), // l00
+     Math.sqrt(1  /  (4 * Math.PI)), // l00
 
 
-    Math.sqrt(3  /  (4 * Math.PI)), // l1_1
-    Math.sqrt(3  /  (4 * Math.PI)), // l10
-    Math.sqrt(3  /  (4 * Math.PI)), // l11
+    -Math.sqrt(3  /  (4 * Math.PI)), // l1_1
+     Math.sqrt(3  /  (4 * Math.PI)), // l10
+    -Math.sqrt(3  /  (4 * Math.PI)), // l11
 
 
-    Math.sqrt(15 /  (4 * Math.PI)), // l2_2
-    Math.sqrt(15 /  (4 * Math.PI)), // l2_1
-    Math.sqrt(5  / (16 * Math.PI)), // l20
-    Math.sqrt(15 /  (4 * Math.PI)), // l21
-    Math.sqrt(15 / (16 * Math.PI)), // l22
+     Math.sqrt(15 /  (4 * Math.PI)), // l2_2
+    -Math.sqrt(15 /  (4 * Math.PI)), // l2_1
+     Math.sqrt(5  / (16 * Math.PI)), // l20
+    -Math.sqrt(15 /  (4 * Math.PI)), // l21
+     Math.sqrt(15 / (16 * Math.PI)), // l22
 ];
 ];
 
 
 // cm = cos(m * phi)
 // cm = cos(m * phi)

+ 2 - 2
src/Shaders/ShadersInclude/harmonicsFunctions.fx

@@ -17,7 +17,7 @@
         //   http://www-graphics.stanford.edu/papers/envmap/
         //   http://www-graphics.stanford.edu/papers/envmap/
         // The only difference is the integration of the reconstruction coefficients direcly
         // The only difference is the integration of the reconstruction coefficients direcly
         // into the vectors as well as the 1 / pi multiplication to simulate a lambertian diffuse.
         // into the vectors as well as the 1 / pi multiplication to simulate a lambertian diffuse.
-        vec3 environmentIrradiance(vec3 normal) {
+        vec3 computeEnvironmentIrradiance(vec3 normal) {
             return vSphericalL00
             return vSphericalL00
 
 
                 + vSphericalL1_1 * (normal.y)
                 + vSphericalL1_1 * (normal.y)
@@ -42,7 +42,7 @@
         uniform vec3 vSphericalZX;
         uniform vec3 vSphericalZX;
 
 
         // By Matthew Jones.
         // By Matthew Jones.
-        vec3 environmentIrradiance(vec3 normal) {
+        vec3 computeEnvironmentIrradiance(vec3 normal) {
             // Fast method for evaluating a fixed spherical harmonics function on the sphere (e.g. irradiance or radiance).
             // Fast method for evaluating a fixed spherical harmonics function on the sphere (e.g. irradiance or radiance).
             // Cost: 24 scalar operations on modern GPU "scalar" shader core, or 8 multiply-adds of 3D vectors:
             // Cost: 24 scalar operations on modern GPU "scalar" shader core, or 8 multiply-adds of 3D vectors:
             // "Function Cost 24	24x mad"
             // "Function Cost 24	24x mad"