render3d: the survey DEM is let go once the height field is made, and the terrain sun shadow is R32F + RG16F

The DEM (R16 with mips, 44 MB) was read only by terrain_generate and kept for the map's life; a
world swap loads its own again. The height-field sun shadow was one RGBA32F for three values and an
unused fourth: the lowest lit height stays 32-bit (a receiver 3000 m up compares against it to a
quarter metre), the occluder distance and the cloud mask go beside it in RG16F (64 -> 32 MB), baked
in a pass of their own (TS_AUX): a pipeline takes one colour format for all its targets, and drawn
together into R32F + RG16F the writes went nowhere and nothing was lit.

-75 MB at every fog level, off included (2008 -> 1933 MB at the overlook); the fog-off frame is
unchanged (0 pixels over 8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 16:38:37 +03:00
parent f8c81e4066
commit c5e58d14ea
89 changed files with 205 additions and 74 deletions

View file

@ -239,9 +239,11 @@ function shadow_bind(render3d_st: mut Render3dState, prog: int) -> void {
r3d_bind_tex(render3d_st, prog, "u_shadow", 15, GPU_TEX2D_ARRAY, render3d_st.sh_tex)
# the height-field shadow (terrain.ludic); a stand-in texture keeps the unit valid before the bake
var ts = render3d_st.ter_shadow_tex
var ta = render3d_st.ter_shadow_aux
var ts_on = 1.0
if ts == 0 { ts = render3d_st.ter_height_tex; ts_on = 0.0 }
if ts == 0 or ta == 0 { ts = render3d_st.ter_height_tex; ta = render3d_st.ter_height_tex; ts_on = 0.0 }
r3d_bind_2d(render3d_st, prog, "u_tershadow", 6, ts)
r3d_bind_2d(render3d_st, prog, "u_tershadow_aux", 7, ta)
terrain_bind_height(render3d_st, prog)
u_f(render3d_st, gpu_uniform(render3d_st, prog, "u_ts_on"), ts_on)
u_f(render3d_st, gpu_uniform(render3d_st, prog, "u_ts_half"), float(render3d_st.TERRAIN_HALF))