RT foliage light transmission: leaf cards facing away from the sun pass tinted light (capped layers) #735

Closed
opened 2026-10-12 21:19:59 +00:00 by sky_line · 1 comment
Owner

Background (found in a dense-canopy sim): with shadow maps, light and god rays pour through overlapping leaf cards; with RT sun shadows the canopy is solid. The cause: our shadow pass culls back faces of single-sided casters, as LL does. Single-sided leaf cards usually face outward / down, so from the sun's side they are back faces and cast nothing. RT shadow rays hit triangles from both sides, so every leaf blocks. RT is physically right, but foliage content is built around (and looks good with) the leaky shadow-map behaviour, and real leaves do transmit some light.

Feature: an RT foliage transmission mode for alpha-mask / alpha-blend (foliage) casters only. Opaque and closed geometry keep today's solid behaviour, so single-sided walls and floors don't leak.

  • Facing: a shadow ray travels receiver -> sun. A leaf whose front faces AWAY from the sun (the face the shadow map culls) is the one the ray hits from its front side. Those hits are "transmissive"; a sun-facing leaf hit occludes as today.
  • Transmissive hit: passes the light tinted by the leaf (base colour x tint, scaled by a transmission strength), accumulated through the existing coloured-shadow path (traceShadowRayRGB / translucent split).
  • Cheap by design (owner): at most N transmissive layers commit colour (default N = 2, debug setting); after N the ray stops with the accumulated tint. That's roughly double today's foliage hits, far cheaper than tracing every layer.
  • Opaque blockers stay solid: early termination must never let light through a solid non-foliage blocker (roof, trunk, wall) the candidate loop hadn't reached yet -- e.g. a cheap opaque-only ray first (cull mask excluding foliage), then the foliage ray.
  • Modes (setting): 0 off (today: both sides block), 1 cull (LL / shadow-map parity: away-from-sun leaf faces fully pass -- free, hardware culling), 2 tinted transmission (default once tuned). Strength, tint amount and the layer cap (debug).
  • Applies to: RT sun / moon shadow mask, RT god rays (same shadow rays), inline RT for transparent receivers; RT projectors if trivial. Shadow maps unchanged.
  • Distance: follows the existing RT alpha distance controls; far foliage can fall back to mode 1 (cheap).
**Background (found in a dense-canopy sim):** with shadow maps, light and god rays pour through overlapping leaf cards; with RT sun shadows the canopy is solid. The cause: our shadow pass culls back faces of single-sided casters, as LL does. Single-sided leaf cards usually face outward / down, so from the sun's side they are back faces and cast nothing. RT shadow rays hit triangles from both sides, so every leaf blocks. RT is physically right, but foliage content is built around (and looks good with) the leaky shadow-map behaviour, and real leaves do transmit some light. **Feature:** an RT foliage transmission mode for alpha-mask / alpha-blend (foliage) casters only. Opaque and closed geometry keep today's solid behaviour, so single-sided walls and floors don't leak. - **Facing:** a shadow ray travels receiver -> sun. A leaf whose front faces AWAY from the sun (the face the shadow map culls) is the one the ray hits from its front side. Those hits are "transmissive"; a sun-facing leaf hit occludes as today. - **Transmissive hit:** passes the light tinted by the leaf (base colour x tint, scaled by a transmission strength), accumulated through the existing coloured-shadow path (traceShadowRayRGB / translucent split). - **Cheap by design (owner):** at most N transmissive layers commit colour (default N = 2, debug setting); after N the ray stops with the accumulated tint. That's roughly double today's foliage hits, far cheaper than tracing every layer. - **Opaque blockers stay solid:** early termination must never let light through a solid non-foliage blocker (roof, trunk, wall) the candidate loop hadn't reached yet -- e.g. a cheap opaque-only ray first (cull mask excluding foliage), then the foliage ray. - **Modes (setting):** 0 off (today: both sides block), 1 cull (LL / shadow-map parity: away-from-sun leaf faces fully pass -- free, hardware culling), 2 tinted transmission (default once tuned). Strength, tint amount and the layer cap (debug). - **Applies to:** RT sun / moon shadow mask, RT god rays (same shadow rays), inline RT for transparent receivers; RT projectors if trivial. Shadow maps unchanged. - **Distance:** follows the existing RT alpha distance controls; far foliage can fall back to mode 1 (cheap).
sky_line added this to the Slipstream project 2026-10-12 21:19:59 +00:00
Author
Owner

Shipped in 1.3.0 Beta 8 (edecf2802b RT foliage light transmission, cull / tint modes; 04ff42e313 follows the Translucent shadows option). Closing -- reopen or comment if you still see this.

Shipped in 1.3.0 Beta 8 (edecf2802b RT foliage light transmission, cull / tint modes; 04ff42e313 follows the Translucent shadows option). Closing -- reopen or comment if you still see this.
sky_line 2026-10-14 06:33:44 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#735
No description provided.