ludic/changes/foliage-prepass.md
Orkuncakilkaya d6ffdfa638 perf(render3d): a depth prepass for the near tree foliage
Needle-card crowns are many cut-out quads deep and a discarding shader turns early depth
rejection off, so every card behind the front one ran the full lighting shader. The near
tree LODs now write depth first (depth.frag, the same alpha coverage test), terrain under
them is rejected before shading, and the lit pass draws them with no discard and an equal
depth test (invariant gl_Position). R3D_NOPREPASS=1 restores the old path.

Dense forest on a Windows PC: 61 -> 78 fps at 3840x2160, 116 -> 164 fps at 1920x1080.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 04:18:38 +03:00

662 B

bump: patch type: perf Dense forest renders faster — a depth prepass for the near tree foliage in ludic.render3d.

A crown of needle cards is many cut-out quads deep, and a shader that can discard turns early depth rejection off, so every card behind the front one ran the full lighting shader. In a dense stand at 3840x2160 that made the vegetation pass the largest in the frame. The near tree LODs now write depth first with depth.frag (the same alpha coverage test), the terrain beneath them is rejected before shading, and the lit pass draws them with no discard and an equal depth test. R3D_NOPREPASS=1 restores the old path for comparison.