From bc648015c7cb4009b43b18b2169bd16b1acd2e2c Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Wed, 19 Dec 2018 11:07:39 +0100 Subject: [PATCH] - vWorldNormal is not normalized but R_DoomColormap requires this --- wadsrc/static/shaders/glsl/main.fp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wadsrc/static/shaders/glsl/main.fp b/wadsrc/static/shaders/glsl/main.fp index e6ec4c63f..f033ac2f0 100644 --- a/wadsrc/static/shaders/glsl/main.fp +++ b/wadsrc/static/shaders/glsl/main.fp @@ -122,12 +122,12 @@ vec4 getTexel(vec2 st) // Vanilla Doom wall colormap equation // //=========================================================================== -float R_WallColormap(float lightnum, float z) +float R_WallColormap(float lightnum, float z, vec3 normal) { // R_ScaleFromGlobalAngle calculation float projection = 160.0; // projection depends on SCREENBLOCKS!! 160 is the fullscreen value vec2 line_v1 = pixelpos.xz; // in vanilla this is the first curline vertex - vec2 line_normal = vWorldNormal.xz; + vec2 line_normal = normal.xz; float texscale = projection * clamp(dot(normalize(uCameraPos.xz - line_v1), line_normal), 0.0, 1.0) / z; float lightz = clamp(16.0 * texscale, 0.0, 47.0); @@ -174,7 +174,8 @@ float R_DoomColormap(float light, float z) if (dot(vWorldNormal.xyz, vWorldNormal.xyz) > 0.5) { - return mix(R_WallColormap(lightnum, z), R_PlaneColormap(lightnum, z), abs(vWorldNormal.y)); + vec3 normal = normalize(vWorldNormal.xyz); + return mix(R_WallColormap(lightnum, z, normal), R_PlaneColormap(lightnum, z), abs(normal.y)); } else // vWorldNormal is not set on sprites {