I've been digging into @UnrealEngine 5's Lumen yesterday to make it work with my voxels.
Here's what I learned along the way, if anyone's curious
(if I say something wrong please correct me :) )
I'll use the following scene as an example: a sphere with a colored emissive material, a white plane and no light whatsoever
For reference, here's how it looks without Lumen
The first thing we can do is disable screen space traces using r.Lumen.ScreenProbeGather.ScreenTraces 0
As you can see, the GI looks a lot worse with only the voxel grid (?) contribution
To know the mesh color/emissive/normal without sampling the material all the time, Lumen uses a surface cache system.
You can see the values stored in that cache using Show -> Visualize -> Lumen Scene
That cache works by rendering the mesh under different angles to an atlas. Each angle is defined using a "card": a rectangle onto which the mesh is rendered.
You can view these using r.Lumen.Visualize.CardPlacement 1
Below: the -X and +Z cards
The atlases are stored in Lumen.SceneAlbedo/SceneDepth/SceneNormal etc
You can use RenderDoc to view these, or the vis Lumen.SceneAlbedo command in UE
The cards are updated when the camera moves, as their resolutions are based on the distance from it.
You can use r.LumenScene.RecaptureEveryFrame 1 to force a recapture of all the cards in every frame
In our scene, the plane is rendered once and the sphere 6 times as expected
To find the color at a position, all we have to do now is find the best cards representing that position, project it onto them & read the values.
Lumen also reads the Depth atlas to ignore cards that would be occluded (I think 😄 )
As you can see below, this is not screen space anymore but proper GI!
The generated distance fields are kind of a mess for cubes though. I tried to switch to cube instances to render the DF, but it's not working very well & is pretty slow.
I'll see if I can figure out a nice DF grid alignment to better represent the cubes.