Let the trees cast shadows #80

Closed
opened 2026-10-20 08:49:26 +00:00 by sermuns · 0 comments
Owner

The shadow pass records only scene.buildings and is rebuilt only when the
light direction changes. ARCHITECTURE.md is explicit: buildings cast; ground,
trees, decor and bodies receive.

The forest is the largest thing on campus, and it floats. Tree contact shadows
are the cheapest depth cue the scene is currently missing; the screenshots of the
campus from above show a green field with trees pasted on it.

Trees are static, so they do not break the "build the map once" property: add the
TreeBatch instances to the caster list with a vertex-only twin of TREE_VERTEX
that reads the per-instance transforms, and let the existing shadow map bake them.
Props and decor are the same geometry path and can follow if the bias holds up.

Two things to get right:

  • The 2-texel slope bias is roughly a metre at campus scale, so thin trunks may
    lose their base or detach. Tune against the map, not against NDC depth.
  • The fitted box already includes every building, but the forest may reach past
    it, so the caster AABB needs both.

Related: #81 for casters that move, and #82 for the contact
darkening that a shadow map cannot resolve.

The shadow pass records only `scene.buildings` and is rebuilt only when the light direction changes. ARCHITECTURE.md is explicit: buildings cast; ground, trees, decor and bodies receive. The forest is the largest thing on campus, and it floats. Tree contact shadows are the cheapest depth cue the scene is currently missing; the screenshots of the campus from above show a green field with trees pasted on it. Trees are static, so they do not break the "build the map once" property: add the `TreeBatch` instances to the caster list with a vertex-only twin of `TREE_VERTEX` that reads the per-instance transforms, and let the existing shadow map bake them. Props and decor are the same geometry path and can follow if the bias holds up. Two things to get right: - The 2-texel slope bias is roughly a metre at campus scale, so thin trunks may lose their base or detach. Tune against the map, not against NDC depth. - The fitted box already includes every building, but the forest may reach past it, so the caster AABB needs both. Related: #81 for casters that move, and #82 for the contact darkening that a shadow map cannot resolve.
sermuns added this to the Rendering milestone 2026-10-20 08:49:26 +00:00
Sign in to join this conversation.
No description provided.