Skip to content

Commit

Permalink
Avoid NaNs in heightfog shader.
Browse files Browse the repository at this point in the history
Fixes small ‘dead pixel’ artifacts visible in dark areas.
  • Loading branch information
skullernet committed Oct 24, 2024
1 parent 4712833 commit 700de33
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/refresh/shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ static void write_height_fog(sizebuf_t *buf)
{
GLSL({
float dir_z = normalize(v_world_pos - u_vieworg).z;
float s = sign(dir_z);
dir_z += 0.00001 * (1.0 - s * s);
float eye = u_vieworg.z - u_heightfog_start.w;
float pos = v_world_pos.z - u_heightfog_start.w;
float density = (exp(-u_heightfog_falloff * eye) -
Expand Down

0 comments on commit 700de33

Please sign in to comment.