Ver Fonte

Fix missing wViewDir variable

The wViewDir varying was changed to be stored in the surfface.viewDir value, so all references in the shader needed to be updated to match this.

I also changed some floats to be in decimal format.
Ryan McDonough há 7 meses atrás
pai
commit
139b7d29bd

+ 8 - 8
jme3-core/src/main/resources/Common/ShaderLib/module/pbrlighting/PBRLightingUtils.glsllib

@@ -285,9 +285,9 @@
         
         void PBRLightingUtils_readPBRSurface(inout PBRSurface surface){
 
-            surface.bakedLightContribution = vec3(0);
-            surface.directLightContribution = vec3(0);
-            surface.envLightContribution = vec3(0);
+            surface.bakedLightContribution = vec3(0.0);
+            surface.directLightContribution = vec3(0.0);
+            surface.envLightContribution = vec3(0.0);
 
             #ifdef ENABLE_PBRLightingUtils_getWorldTangent
                 vec3 tan = normalize(wTangent.xyz); 
@@ -297,7 +297,7 @@
 
             
             #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP)))
-                vec3 vViewDir =  wViewDir * surface.tbnMat;  
+                vec3 vViewDir =  surface.viewDir * surface.tbnMat;  
                 #ifdef STEEP_PARALLAX
                     #ifdef NORMALMAP_PARALLAX
                         //parallax map is stored in the alpha channel of the normal map         
@@ -429,7 +429,7 @@
                 #endif
                 surface.emission = emissive.rgb * pow(emissive.a, m_EmissivePower) * m_EmissiveIntensity;
             #else 
-                surface.emission = vec3(0);
+                surface.emission = vec3(0.0);
             #endif
 
             PBRLightingUtils_readSunLightExposureParams(surface);
@@ -573,8 +573,8 @@
 
 
             #if NB_PROBES > 0
-                float probeNdfSum=0;
-                float invProbeNdfSum=0;    
+                float probeNdfSum = 0.0;
+                float invProbeNdfSum = 0.0;    
 
                 #for i=1..4 ( #if NB_PROBES >= $i $0 #endif )
                     vec3 probeColor$i;
@@ -607,7 +607,7 @@
                 #endfor
 
                 #if NB_PROBES > 1
-                    float probeWeightSum=0;
+                    float probeWeightSum= 0.0;
                     #for i=1..4 ( #if NB_PROBES >= $i $0 #endif )
                         float probeWeight$i = ((1.0 - (probeNdf$i / probeNdfSum)) / (NB_PROBES - 1)) *  ( probeInvNdf$i / invProbeNdfSum);
                         probeWeightSum += probeWeight$i;