1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-20 19:45:22 +02:00

Port shadow shaders to work with OpenGL3

Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
PtiLuky
2025-10-13 11:04:07 +02:00
committed by sfan5
parent 5e23e478b1
commit d834c45d1c
13 changed files with 128 additions and 264 deletions

View File

@@ -0,0 +1,28 @@
uniform sampler2D ShadowMapClientMap;
#ifdef COLORED_SHADOWS
uniform sampler2D ShadowMapClientMapTraslucent;
#endif
uniform sampler2D ShadowMapSamplerdynamic;
#ifdef GL_ES
varying mediump vec2 varTexCoord;
#else
centroid varying vec2 varTexCoord;
#endif
void main()
{
#ifdef COLORED_SHADOWS
vec2 first_depth = texture2D(ShadowMapClientMap, varTexCoord).rg;
vec2 depth_splitdynamics = vec2(texture2D(ShadowMapSamplerdynamic, varTexCoord).r, 0.0);
if (first_depth.r > depth_splitdynamics.r)
first_depth = depth_splitdynamics;
vec2 depth_color = texture2D(ShadowMapClientMapTraslucent, varTexCoord).rg;
gl_FragColor = vec4(first_depth.r, first_depth.g, depth_color.r, depth_color.g);
#else
float first_depth = texture2D(ShadowMapClientMap, varTexCoord).r;
float depth_splitdynamics = texture2D(ShadowMapSamplerdynamic, varTexCoord).r;
first_depth = min(first_depth, depth_splitdynamics);
gl_FragColor = vec4(first_depth, 0.0, 0.0, 1.0);
#endif
}