Platform: Rework defaultskin and defaultwall glsl their 'gl_ldr' hack to

how certain GoldSrc games look, with more accurate lightmap banding.
This commit is contained in:
Marco Cawthorne 2022-01-10 17:41:01 -08:00
parent 009462f3ee
commit 1d5cb6dcdb
Signed by: eukara
GPG Key ID: C196CD8BA993248A
2 changed files with 28 additions and 3 deletions

View File

@ -78,9 +78,19 @@ varying vec3 light;
light *= e_lmscale.r;
#if gl_ldr==1
light *= 0.75;
#endif
if (gl_ldr == 1.0) {
if (light.r > 1.5)
light.r = 1.5f;
if (light.g > 1.5)
light.g = 1.5f;
if (light.b > 1.5)
light.b = 1.5f;
light.rgb * 0.5f;
light.rgb = floor(light.rgb * vec3(32,64,32))/vec3(32,64,32);
light.rgb * 2.0f;
light.rgb *= 0.75f;
}
#ifdef CHROME
vec3 rorg = rlv(vec3(0,0,0), w, e_light_dir);

View File

@ -12,6 +12,7 @@
!!cvardf gl_mono
!!cvardf gl_kdither
!!cvardf gl_stipplealpha
!!cvardf gl_ldr
!!cvardf r_skipDiffuse
!!cvardf r_skipLightmap
@ -86,6 +87,19 @@ varying mat3 invsurface;
#else
lightmaps = texture2D(s_lightmap, lm0).rgb * e_lmscale.rgb;
#endif
#if gl_ldr==1
if (lightmaps.r > 1.5)
lightmaps.r = 1.5f;
if (lightmaps.g > 1.5)
lightmaps.g = 1.5f;
if (lightmaps.b > 1.5)
lightmaps.b = 1.5f;
lightmaps.rgb * 0.5f;
lightmaps.rgb = floor(lightmaps.rgb * vec3(32,64,32))/vec3(32,64,32);
lightmaps.rgb * 2.0f;
#endif
return lightmaps;
}
#else
@ -142,6 +156,7 @@ varying mat3 invsurface;
}
#endif
/* lighting */
//diffuse_f.rgb = vec3(1,1,1);
diffuse_f.rgb *= lightmap_fragment();
#ifdef REFLECTCUBE