Graphics Reference
In-Depth Information
Figure 4.23. Cone-tracing algorithm capable of producing glossy reflections in screen
space. Notice how the algorithm ensures that the further the reflection is from caster,
the more spread it becomes like in the real world.
There is a conflict between the Hi-Z tracer and the cone tracer. Hi-Z tries to
find a perfect specular as fast as possible while the cone tracer needs to take linear
steps to integrate the total visibility in front-to-back order for correct occlusion.
This is not shown in this chapter because of complexity but the Hi-Z buffer
is actually used together with the cone angle to find an early intersection at a
coarse level to early exit out of the Hi-Z loop; then, we jump straight to the
cone-tracing pass to continue with the linear stepping for glossy reflections. The
Hi-Z functions as an empty-space determiner; once we have a coarse intersection
with the cone, we can jump straight into the cone tracer to integrate the visibility
and colors from that point onwards.
The more roughness we have on our surfaces, the cheaper this technique gets
because we sample bigger circles and do larger jumps. Conversely, the less rough
the surface is, the further the Hi-Z can travel for a perfect specular reflection so
it all balances out evenly. Again, implementation is dependent on whether you
use post-projected Hi-Z or view-space Hi-Z.
4.6 Extensions
4.6.1 Smoothly Fading Artifacts
We already talked about the inherent problems with screen-space local reflection
in Section 4.2. Without further ado, rays traveling the opposite direction of the
viewing ray and rays that fall close to the screen borders or outside the screen
should be faded away due to lack of information available to us in the screen
space. We can also fade rays based on ray travel distance.
A quick and simple implementation is shown in Listing 4.8. The demo ships
with a more robust implementation.
One could fade away based on local occlusion as well, where a ray starts
traveling behind an object and fails to find a proper intersection. One would
Search WWH ::




Custom Search