Graphics Reference
In-Depth Information
Figure 6.4. Left: Original normals. Right: Normals by the time the wire goes sub-pixel,
assuming the viewer is to the right of the wire.
If sticking to Half Lambert is not enough, there are a few different approaches
for dealing with this. We have tried a couple of methods that both work rela-
tively well and can also be combined. Both involve fading over from our regular
lighting model into something uniformly colored over some distance before reach-
ing pixel size. The first method is simply computing our lighting as usual, then
computing the Half Lambert as well, and then fading between these two. In our
test scene a good fade range was from about 4 pixels wide and fully faded over
to Half Lambert as it reached a single pixel. This is not based on any science but
purely from testing various ranges and subjectively selecting what looked best
for us. Depending on your lighting model and parameters, this could be tweaked
differently. The advantage of this method is that it is straightforward and simple
and tends to work fairly well.
The other method we tried involves flattening the normals over the distance.
The thinner the wire gets, the more we are bending the normals toward the
center normal from the viewer's point of view. As the wire goes down to a single
pixel width, the normal will be entirely flat, and consequently result in a uniform
lighting result. (See Figure 6.4.)
Since all this does is modify the input normal, this method is compatible with
any lighting model, although results may vary.
6.2.4 Use with Deferred Shading
Deferred shading typically has a single global lighting model. This could make it
tricky to fade between a soft light model, such as Half Lambert, and the engine's
regular lighting model. The most straightforward approach is to simply render
wires in a forward pass after the deferred lighting pass. The blended part of the
wire (i.e., where it is smaller than a pixel wide) will have to be rendered as a
translucent object anyway because of the blending. Typically wires take up a
very small amount of screen space, so rendering the entire wire, including fully
opaque parts, would normally have a minimal impact on performance. In the
case where it is desirable to render opaque parts into the G-buffer, the normal
bending approach above integrates very well as all it does is modify the input
Search WWH ::




Custom Search