1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Support OpenGL 3 (#13321)

This commit is contained in:
Vitaliy 2024-01-16 23:09:18 +03:00 committed by GitHub
parent 9cca12ff0b
commit 8093044f07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 26 additions and 22 deletions

View file

@ -14,7 +14,7 @@ centroid varying vec2 varTexCoord;
// smoothstep - squared
float smstsq(float f)
{
f = f * f * (3 - 2 * f);
f = f * f * (3. - 2. * f);
return f;
}

View file

@ -14,7 +14,7 @@ centroid varying vec2 varTexCoord;
// smoothstep - squared
float smstsq(float f)
{
f = f * f * (3 - 2 * f);
f = f * f * (3. - 2. * f);
return f;
}

View file

@ -161,7 +161,7 @@ float getPenumbraRadius(sampler2D shadowsampler, vec2 smTexCoord, float realDist
float depth_to_blur = f_shadowfar / SOFTSHADOWRADIUS / xyPerspectiveBias0;
if (depth > 0.0 && f_normal_length > 0.0)
// 5 is empirical factor that controls how fast shadow loses sharpness
sharpness_factor = clamp(5 * depth * depth_to_blur, 0.0, 1.0);
sharpness_factor = clamp(5.0 * depth * depth_to_blur, 0.0, 1.0);
depth = 0.0;
float world_to_texture = xyPerspectiveBias1 / perspective_factor / perspective_factor

View file

@ -242,7 +242,7 @@ void main(void)
if (f_normal_length > 0.0) {
nNormal = normalize(vNormal);
cosLight = max(1e-5, dot(nNormal, -v_LightDirection));
float sinLight = pow(1 - pow(cosLight, 2.0), 0.5);
float sinLight = pow(1.0 - pow(cosLight, 2.0), 0.5);
normalOffsetScale = 2.0 * pFactor * pFactor * sinLight * min(f_shadowfar, 500.0) /
xyPerspectiveBias1 / f_textureresolution;
z_bias = 1.0 * sinLight / cosLight;
@ -250,7 +250,7 @@ void main(void)
else {
nNormal = vec3(0.0);
cosLight = clamp(dot(v_LightDirection, normalize(vec3(v_LightDirection.x, 0.0, v_LightDirection.z))), 1e-2, 1.0);
float sinLight = pow(1 - pow(cosLight, 2.0), 0.5);
float sinLight = pow(1.0 - pow(cosLight, 2.0), 0.5);
normalOffsetScale = 0.0;
z_bias = 3.6e3 * sinLight / cosLight;
}

View file

@ -147,7 +147,7 @@ void main(void)
if (f_normal_length > 0.0) {
nNormal = normalize(vNormal);
cosLight = max(1e-5, dot(nNormal, -v_LightDirection));
float sinLight = pow(1 - pow(cosLight, 2.0), 0.5);
float sinLight = pow(1.0 - pow(cosLight, 2.0), 0.5);
normalOffsetScale = 0.1 * pFactor * pFactor * sinLight * min(f_shadowfar, 500.0) /
xyPerspectiveBias1 / f_textureresolution;
z_bias = 1e3 * sinLight / cosLight * (0.5 + f_textureresolution / 1024.0);
@ -155,7 +155,7 @@ void main(void)
else {
nNormal = vec3(0.0);
cosLight = clamp(dot(v_LightDirection, normalize(vec3(v_LightDirection.x, 0.0, v_LightDirection.z))), 1e-2, 1.0);
float sinLight = pow(1 - pow(cosLight, 2.0), 0.5);
float sinLight = pow(1.0 - pow(cosLight, 2.0), 0.5);
normalOffsetScale = 0.0;
z_bias = 3.6e3 * sinLight / cosLight;
}