2
0
Эх сурвалжийг харах

Fixed point light shadows not working in OpenGL forward rendering.

Lasse Öörni 13 жил өмнө
parent
commit
c41de41381

+ 6 - 2
Bin/CoreData/Shaders/GLSL/LitSolid.vert

@@ -59,8 +59,12 @@ void main()
     
         #ifdef SHADOW
             // Shadow projection: transform from world space to shadow space
-            for (int i = 0; i < NUMCASCADES; i++)
-                vShadowPos[i] = cLightMatrices[i] * projWorldPos;
+            #ifndef POINTLIGHT
+                for (int i = 0; i < NUMCASCADES; i++)
+                    vShadowPos[i] = cLightMatrices[i] * projWorldPos;
+            #else
+                vShadowPos[0] = vec4(projWorldPos.xyz - cLightPos.xyz, 1.0);
+            #endif
         #endif
     
         #ifdef SPOTLIGHT

+ 6 - 2
Bin/CoreData/Shaders/GLSL/TerrainBlend.vert

@@ -39,8 +39,12 @@ void main()
 
         #ifdef SHADOW
             // Shadow projection: transform from world space to shadow space
-            for (int i = 0; i < NUMCASCADES; i++)
-                vShadowPos[i] = cLightMatrices[i] * projWorldPos;
+            #ifndef POINTLIGHT
+                for (int i = 0; i < NUMCASCADES; i++)
+                    vShadowPos[i] = cLightMatrices[i] * projWorldPos;
+            #else
+                vShadowPos[0] = vec4(projWorldPos.xyz - cLightPos.xyz, 1.0);
+            #endif
         #endif
 
         #ifdef SPOTLIGHT