Skip to content

Show the dice faintly in a glossy table - #379

Merged
drehtuer merged 1 commit into
rendering/pbr-lightingfrom
rendering/glass-reflections
Oct 5, 2026
Merged

drehtuer merged 1 commit into
rendering/pbr-lightingfrom
rendering/glass-reflections

Conversation

@drehtuer

@drehtuer drehtuer commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Owner request: the dark glass should reflect the dice a bit, not perfectly.

Technique (decision 93): a planar reflection of the dice only.

  • When the floor is glossy, a second Filament view draws only the dice into a quarter-size RGBA16F texture, seen from the main camera turned over in the floor plane.
  • The tray sits on its own layer, which that view doesn't see.
  • The floor's new GLASS material variant samples that texture and adds it, weighted by Fresnel × the table's strength. The variant is compiled lazily and cached.
  • The quarter size blurs it, so numbers in the reflection are a smudge.

Why not Filament's screen-space reflections (from reading the 1.76.1 shader source):

  • they reflect the walls too, which brings back the dark band along them;
  • in a scene measured in millimetres they come out mirror-sharp;
  • they fade out almost entirely from a top-down view;
  • they need the previous frame and an extra depth pass.

Which tables reflect: derived from roughness, with no format change. Strength = 1 − roughness/0.3, clamped. Dark glass (0.1) gets 2/3; felt, oak and plain get none and pay nothing.

On the Pixel 10a (the whole stack):

  • :render:filament device suite 51/51, with the new ReflectionDeviceTest:
    • a polished floor changes 100 % of the patch in front of a die, a matte one 0 %;
    • the bundled dark glass changes 53 %, felt 0 %.
  • The felt beside the walls is still 0.997–1.027 of the middle.
  • Gallery: a soft, pale smudge of each die in the glass, with no readable numbers.

Judge on the phone: is it too subtle? Reflection's strength mapping is the knob.

Also: tools/harness.sh --rendered --table <id> can now pick a table, to measure the cost on dark glass.

Docs: docs/physics-and-rendering.md ("The dice in a glossy table"), docs/tables.md, docs/build-setup.md, decision 93.

Based on #378.

🤖 Generated with Claude Code

The owner asked for the dark glass to reflect the dice "a bit, not
perfectly". Filament's screen-space reflections were read against
1.76.1's shaders first and ruled out: they reflect everything on screen,
so the walls would lay a dark band along their foot (the band switching
ambient occlusion off removed); their roughness blur is in world units
and comes out sharp in this millimetre scene; and they fade every ray
that turns back towards the camera, which from the default straight-down
view is nearly all of them.

Instead a glossy floor gets a planar reflection of the dice alone: a
second view from the camera turned over in the floor, a quarter of the
screen each way, no shadows and no post pass, with the tray on a layer
it does not see. The floor, a third material compiled on first use,
adds that picture times its own Fresnel term and the table's strength
and lowers its reflectance as much where a die is, so a white die shows
as a soft pale patch and a dark one as a darker one. The small picture
is the blur and most of why it is cheap.

Whether a table reflects is read off its roughness (under 0.3; dark
glass at 0.1 is two-thirds strength), so the format does not change and
felt, oak and plain stay on the opaque material, drawing exactly as
before at no cost. The rendered harness gains --table so the cost can
be measured on dark-glass (decision 93).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 4, 2026

Copy link
Copy Markdown

@drehtuer
drehtuer added this pull request to stack #386 October 5, 2026 06:37
@drehtuer
drehtuer merged commit 12ff4a7 into feature/realistic-rendering Oct 5, 2026
9 checks passed
@drehtuer
drehtuer deleted the rendering/glass-reflections branch October 5, 2026 06:37
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