Game Development Reference
In-Depth Information
diffuseGlobalIllum.g = dot(greenSHCoeffs ,surfaceNormalLobe);
diffuseGlobalIllum.b = dot(blueSHCoeffs ,surfaceNormalLobe);
diffuseIllum = max(diffuseIllum ,float3(0.0f,0.0f,0.0f));
diffuseGlobalIllum /= PI;
output.fragColor = float4(diffuseGlobalIllum*albedo,1.0f);
return output;
}
Listing 7.4. Indirect lighting.
As can be seen in the above listing, only the diffuse indirect illumination is
calculated. However there is the possibility to extract a dominant light source
from SH-coecients [Sloan 08]. With the help of this extracted light source, a
conventional specular lighting can be performed. This gives us the possibility to
add a fast, but coarse, approximation of specular indirect lighting.
7.3.5 Clear the Voxel Grid
In this final step the RWStructuredBuffer used for the voxel grid is cleared by using
a simple compute shader. Just like for the propagation step, the compute shader
is dispatched with 4
×
4
×
4 thread groups, whereby each thread group runs
8
×
8
×
8 threads, so that 32
×
32
×
32 threads are utilized, which corresponds
to the total voxel count of the grid.
7.4
Handling Large Environments
Since we are using a 32
32 voxel grid, it is quite obvious that this alone
cannot deal with realistic large game environments. According to the use of multi-
ple cascades in the LPV technique proposed by [Kaplanyan and Dachsbacher 10],
several nested voxel grids can be used. Each grid will have the same number
of cells, but the size of the grid cells will increase. In this way detailed indirect
lighting can be maintained in the vicinity of the viewer, while in the distance
still sucient coarse indirect lighting is used. However, a linear interpolation
should be performed between the grids to avoid a harsh transition at the borders
between them. This can be done in the step when indirect lighting is applied to
each visible pixel. Therefor across the border area the global illumination value
is calculated for both adjoining grids. The distance of the world-space position
of the current pixel to the center of the higher-resolution grid can be used to
linearly interpolate between both global illumination values.
×
32
×
7.5
Results
Table 7.1 shows the performance results using the proposed technique in the
Sponza scene.
All lights were fully dynamic and contributed to the indirect
illumination.
 
Search Nedrilad ::




Custom Search