render3d: the fog wall is solid by 0.85 of it and the blades end at 0.75

Whatever is cut at the wall is now cut inside full fog: at 0.3-1.0 the last metres before the cut
were 80-95% fogged against fully fogged ground behind, which drew a line of tufts at 70 m and a
dark band of blade tips at 30 m. The blades thin out while the fog is still coming in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 15:41:25 +03:00
parent 2ce2d997be
commit f65bd1aca1
27 changed files with 7 additions and 3 deletions

View file

@ -127,9 +127,12 @@ function grass_init(render3d_st: mut Render3dState) -> void {
} }
# indices per 16 m cell that could exist at distance d (the count the shader computes) # indices per 16 m cell that could exist at distance d (the count the shader computes)
# no blades past the fog wall: they would be drawn only to be fogged away # Under a fog wall the blades end at three quarters of it. A blade's tip stands against ground
# much farther off, and a dark blade 85% fogged read as a dark band against fully fogged ground
# behind it; ending here, they thin out (the cull's last 30%) while the fog is still coming in.
const GRASS_FOG_END: float = 0.75
function grass_reach(render3d_st: Render3dState) -> float { function grass_reach(render3d_st: Render3dState) -> float {
let w = render3d_st.r3d_fog_wall let w = render3d_st.r3d_fog_wall * GRASS_FOG_END
if w > 0.0 and w < render3d_st.grass_radius { return w } if w > 0.0 and w < render3d_st.grass_radius { return w }
return render3d_st.grass_radius return render3d_st.grass_radius
} }

View file

@ -316,7 +316,8 @@ vec3 applyFog(vec3 col, vec3 wpos, float dist) {
col = mix(col, fogCol, f); col = mix(col, fogCol, f);
// the fog wall: from three tenths of its distance to all of it, everything goes to the sky's colour // the fog wall: from three tenths of its distance to all of it, everything goes to the sky's colour
if (u_fog_wall > 0.0) { if (u_fog_wall > 0.0) {
float w = smoothstep(0.3 * u_fog_wall, u_fog_wall, dist); // full by 0.85 of the wall, so whatever is cut at the wall is cut inside solid fog
float w = smoothstep(0.3 * u_fog_wall, 0.85 * u_fog_wall, dist);
col = mix(col, fogWallCol(dir), w); col = mix(col, fogWallCol(dir), w);
} }
return col; return col;