GI radiance cache is wiped almost every frame in busy places (change spheres) #1482

Open
opened 2026-11-06 20:38:51 +00:00 by TheSlowly · 0 comments
Collaborator

In The Void (Celestis, 130/31/999), GI costs about 10 ms per frame: 26.6 ms GPU with RenderVKGI 3, 16.1 ms with GI off. The radiance cache hardly helps there. Only 3-7% of lookups find a cell, and about 100k of 145k live cells are invalidated each frame, while no light changes. Every GI header carries change spheres.

Two causes:

  1. A change sphere far outside the region, at about (301695, -29056, 20), from the geometry (moved/registered) path. Once a header has 64 spheres, giAddSphere grows the last sphere to enclose any extra one. That merge produced a sphere with a radius of about 151 km, which wipes the entire cache for that frame. The store's radiance list (noteGiRadianceDirtyLocked) also merges into the last sphere when full.

  2. Large emitters that move every frame. The builds there have glowing fullbright beams 1024 m long and 0.5 m thick (glow 0.2), plus a 300 m box. Their pose changes every frame, about 75 deltas/s each. Each beam becomes a sphere of about 190 m, plus 2 x 64 m of emitter reach. Every cell near that structure is inside one, every frame. A sphere is a poor fit for a long, thin emitter: the beam only lights what is near its line.

Fix for 1 (PR to follow):

  • Over the cap, merge into the sphere whose enclosing sphere comes out smallest, in both lists.
  • Drop spheres wholly beyond the far clip plus two ray lengths from the camera, before they enter either list. No cache cell can sit out there.

Fix for 2 (planned, same PR or a follow-up; it touches the #1406 design):

  • Send long emitters as capsules (segment + radius), or split them along their long axis.
  • Base the emitter reach on the cross-section, not the bounding radius.
In The Void (Celestis, 130/31/999), GI costs about 10 ms per frame: 26.6 ms GPU with RenderVKGI 3, 16.1 ms with GI off. The radiance cache hardly helps there. Only 3-7% of lookups find a cell, and about 100k of 145k live cells are invalidated each frame, while no light changes. Every GI header carries change spheres. Two causes: 1. A change sphere far outside the region, at about (301695, -29056, 20), from the geometry (moved/registered) path. Once a header has 64 spheres, giAddSphere grows the *last* sphere to enclose any extra one. That merge produced a sphere with a radius of about 151 km, which wipes the entire cache for that frame. The store's radiance list (noteGiRadianceDirtyLocked) also merges into the last sphere when full. 2. Large emitters that move every frame. The builds there have glowing fullbright beams 1024 m long and 0.5 m thick (glow 0.2), plus a 300 m box. Their pose changes every frame, about 75 deltas/s each. Each beam becomes a sphere of about 190 m, plus 2 x 64 m of emitter reach. Every cell near that structure is inside one, every frame. A sphere is a poor fit for a long, thin emitter: the beam only lights what is near its line. Fix for 1 (PR to follow): - Over the cap, merge into the sphere whose enclosing sphere comes out smallest, in both lists. - Drop spheres wholly beyond the far clip plus two ray lengths from the camera, before they enter either list. No cache cell can sit out there. Fix for 2 (planned, same PR or a follow-up; it touches the #1406 design): - Send long emitters as capsules (segment + radius), or split them along their long axis. - Base the emitter reach on the cross-section, not the bounding radius.
TheSlowly added this to the Slipstream project 2026-11-06 20:38:51 +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#1482
No description provided.