Browse Source

Fix vegetation shader for vsm shadows (#2658)

Katekov Anton 5 years ago
parent
commit
d103e6ffa7
1 changed files with 10 additions and 1 deletions
  1. 10 1
      bin/CoreData/Shaders/GLSL/VegetationShadow.glsl

+ 10 - 1
bin/CoreData/Shaders/GLSL/VegetationShadow.glsl

@@ -6,7 +6,11 @@ uniform float cWindHeightPivot;
 uniform float cWindPeriod;
 uniform vec2 cWindWorldSpacing;
 
-varying vec2 vTexCoord;
+#ifdef VSM_SHADOW
+    varying vec4 vTexCoord;
+#else
+    varying vec2 vTexCoord;
+#endif
 
 void VS()
 {
@@ -19,6 +23,11 @@ void VS()
     worldPos.z -= windStrength * cos(windPeriod);
 
     gl_Position = GetClipPos(worldPos);
+    
+#ifdef VSM_SHADOW
+    vTexCoord = vec4(GetTexCoord(iTexCoord), gl_Position.z, gl_Position.w);
+#else
     vTexCoord = GetTexCoord(iTexCoord);
+#endif
 }