feat(render3d): contact darkening, so things sit ON the ground

The existing occlusion is tuned as AMBIENT occlusion: a wide radius answering "how open is
the sky here". That is the right question, and it leaves every object in the frame
hovering - because what says a log is ON the ground rather than in front of it is a hard,
narrow darkening in the last few centimetres where the two meet, and at a metre and a half
of radius that darkening is spread so thin it is not there.

A second, tight pass: eight taps inside 40 cm, which at any normal distance is a handful of
pixels and stays in cache, with a much tighter range check than the ambient one so a wall
across the room does not darken the floor in front of it.

Small by frame area, because contact occlusion is - 1.8% of the frame, 7% of the region
around the things it grounds. GL 7.0 -> 7.1 s, VK 7.3 s over 400 frames.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-19 19:49:05 +03:00
parent 031137a5fa
commit 5ca14eeaec
4 changed files with 38 additions and 2 deletions

View file

@ -469,7 +469,7 @@ T 3e4b62f9 u_shadow 7
T 3e4b62f9 u_tershadow 8
T 3e4b62f9 u_ts_height 9
P 676965ab fullscreen.vert ssgi.frag
B 676965ab frag 1 980
B 676965ab frag 1 984
U 676965ab frag u_cascade_vp 0 mat4 5 64
U 676965ab frag u_cascade_split 320 float 5 16
U 676965ab frag u_cascade_range 400 float 5 16
@ -509,7 +509,8 @@ U 676965ab frag u_proj 896 mat4 1 0
U 676965ab frag u_texel 960 vec2 1 0
U 676965ab frag u_radius 968 float 1 0
U 676965ab frag u_intensity 972 float 1 0
U 676965ab frag u_frame 976 float 1 0
U 676965ab frag u_contact 976 float 1 0
U 676965ab frag u_frame 980 float 1 0
T 676965ab u_brdf 2
T 676965ab u_depth 3
T 676965ab u_irradiance 4