Implementing DDGI
The first shaders we will read are the ray tracing shaders. These, as we saw in Chapter 12, Getting Started with Ray Tracing, come as a bundle that includes the ray-generation, ray-hit, and ray-miss shaders.
There are a set of different methods that convert from world space into grid indices and vice versa that will be used here; they are included with the code.
First, we want to define the ray payload – that is, the information that’s cached after the ray tracing query is performed:
struct RayPayload { vec3 radiance; float distance; };
Ray-generation shader
The first shader is called ray-generation. It spawns rays from the probe’s position using random directions on a sphere using spherical Fibonacci sequences.
Like dithering for TAA and Volumetric Fog, using random directions and temporal accumulation (which happens in the Probe Update shader) allows us to have more information...