Skip to content

feat(binaural): grow the reflection room to contain the scene (S2-16) - #350

Merged
mgth merged 1 commit into
mainfrom
feat/binaural-room-auto-floor
Sep 2, 2026
Merged

feat(binaural): grow the reflection room to contain the scene (S2-16)#350
mgth merged 1 commit into
mainfrom
feat/binaural-room-auto-floor

Conversation

@mgth

@mgth mgth commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

Series 2, lot 3, S2-16 — automatic room floor.

The image-source room was whatever the user configured; a scene larger than it (any unit_scale_m past 1 with the default 4 × 5 × 2.7 m room) had every boundary object pulled back to the wall before mirroring — the reflections of the wall rather than of the object, and a copy of the direct sound 0.1 m behind it from the nearest wall. The doc asked the user to size the room by hand.

  • reflections::room_containing_scene(room, unit_scale_m): each half-extent floored at unit_scale_m + ROOM_FLOOR_MARGIN_M (0.35 m), capped at 20 m. Applied once per frame in render_frame; per channel and per sample nothing changes.
  • The plan wrote the floor as √3·unit_scale_m + margin (the scene's circumscribed sphere). The walls are world-fixed and the scene does not rotate with the head, so per-axis containment of the ADM cube is the exact condition; √3 would have oversized every axis by 73 %.
  • 0.35 m margin: a boundary object's nearest image trails the direct sound by 0.7 m (≈2 ms), and the default 2.7 m ceiling is exactly the floor at unit scale 1 — the default room is unchanged at unit scale 1. At scale 3 every axis becomes 6.7 m, the 6–8 m the doc used to recommend.
  • BINAURAL.md: the room extents are documented as minimums; the Scale tip rewritten.

Tests

  • room_floor_contains_the_scene (reflections.rs): default unchanged at scale 1, 6.7 m at scale 3, generous room kept, 20 m cap, cube corners never clamped.
  • room_grows_to_contain_the_scene (mod.rs): at scale 3 in the default room, the boundary source's nearest reflection lands ≈98 samples (0.7 m) after the direct sound, nothing before.
  • reflections_of_an_outside_source_do_not_coincide_with_the_direct moved to unit scale 12 (past the cap) so the clamp path stays covered.

cargo test -p renderer --lib: 383 passed, 2 ignored. Golden unchanged (reflections off).

🤖 Generated with Claude Code

S2-16. The image-source room was whatever the user configured, and a
scene larger than it — any `unit_scale_m` past 1 with the default
4 × 5 × 2.7 m room — had every boundary object pulled back to the wall
before mirroring: valid geometry, but the reflections of the wall rather
than of the object, and from the nearest wall a copy of the direct sound
0.1 m behind it. BINAURAL.md asked the user to size the room by hand.

The room now grows on its own, axis by axis, to contain the ADM cube:
each half-extent is floored at `unit_scale_m + 0.35 m` (capped at the
20 m the bank models). The walls are world-fixed and the scene does not
rotate with the head, so per-axis containment of the cube is the exact
condition; the 0.35 m margin puts a boundary object's nearest image 0.7 m
(≈2 ms) behind the direct sound, and makes the default 2.7 m ceiling
exactly the floor at unit scale 1 — the default room is unchanged there.
The configured dimensions are therefore a minimum; a room smaller than
the scene it holds had no physical reading anyway. Computed once per
frame: three max/min per axis, nothing per channel or per sample.

The outside-source clamp test moves to unit scale 12, where the cap
still leaves the source outside; a new test checks that at unit scale 3
the boundary source's nearest reflection lands 0.7 m behind the direct
sound with nothing before it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mgth
mgth force-pushed the feat/binaural-room-auto-floor branch from 27d5aeb to 9e49e18 Compare September 2, 2026 17:31
@mgth
mgth merged commit 3a28c4b into main Sep 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant