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:
parent
031137a5fa
commit
5ca14eeaec
4 changed files with 38 additions and 2 deletions
|
|
@ -50,6 +50,7 @@ var post_ao_blur: Target = null
|
|||
var post_p_ao: int = 0
|
||||
var post_p_ao_blur: int = 0
|
||||
var post_ao_radius: int = 0
|
||||
var post_contact: int = 0x3FA00000 # 1.25: how hard a thing is darkened where it meets the ground
|
||||
var post_ao_intensity: int = 0
|
||||
var post_ao_strength: int = 0
|
||||
var post_gi_strength: int = 0x3ECCCCCD # 0.4
|
||||
|
|
@ -297,6 +298,9 @@ function post_ssao_pass() -> void {
|
|||
u_f2(gpu_uniform(post_p_ao, "u_texel"), fr(1, post_w), fr(1, post_h))
|
||||
u_f(gpu_uniform(post_p_ao, "u_radius"), post_ao_radius)
|
||||
u_f(gpu_uniform(post_p_ao, "u_intensity"), post_ao_intensity)
|
||||
var contact = post_contact
|
||||
if r3d_env_has("R3D_NOCONTACT") { contact = F_ZERO }
|
||||
u_f(gpu_uniform(post_p_ao, "u_contact"), contact)
|
||||
mesh_draw(post_fs)
|
||||
target_bind(post_ao_blur)
|
||||
gpu_use_program(post_p_ao_blur)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue