next up previous contents
Next: 11.2.3 Cube Environment Mapping Up: 11.2.2 Dual-Paraboloid Environment Mapping Previous: 11.2.2.3 Advantages and Disadvantages   Contents

11.2.2.4 Cheap Per-pixel Lighting

One application of dual-paraboloid texture mapping deserving particular note is implementing a view-independent form of textured per-pixel lighting. Two textures can encode a specular lighting solution as a dual-paraboloid map. Another two textures can encode a diffuse lighting solution as a dual-paraboloid map. By indexing the specular dual-paraboloid map by the eye-space reflection vector and the diffuse dual-paraboloid map by the eye-space normal vector, a complete specular-diffuse lighting solution is possible.

The same approach could be used with sphere mapping, but the cost of regenerating and downloading two sphere maps for the diffuse and specular contributions whenever the view changes will undermine good performance. Because dual-paraboloid maps are view-independent, the same dual-paraboloid maps can be used in changing views. Additionally, the sphere map sparkling artifacts are not an issue when using dual-paraboloid maps.

You can support an unlimited number of lights through this approach with no extra cost beyond that required to construct the dual-paraboloid maps. Directional lights are easily supported, but supporting positional requires constructing distinct dual-paraboloid maps for localized regions of space and assuming such regions are relatively positional independent with respect to lighting. Essentially, positional lights must be treated as directional lights for a localized region where the dual-paraboloid maps are used. High-quality shiny specular contributions may require increasing the resolution in the specular dual-paraboloid texture map. Modulating the texture color with the interpolated per-vertex color provides the equivalent of fast per-vertex color material changes. Spotlights and attenuation are not possible with this approach. Because the texture look ups into each dual-paraboloid map are performed per-pixel, this approach is rightfully considered a per-pixel lighting method. Unlike per-vertex lighting models, this approach can reproduce consistent specular highlights even on relatively poorly tessellated geometry.

With a single texture unit, this approach requires four textured rendering passes. After two passes to generate the diffuse lighting contribution, use additive blending to add in the specular contribution in the third and fourth specular passes. Modulating the diffuse lighting contribution with a surface texture requires an initial fifth rendering pass. Existing multitexture hardware supporting two texture units can implement this technique in two passes and add a surface texture with a third pass. Future hardware supporting five texture units and a suitably extended texture environment to combine all these units (the ARB_multitexture base texture environment is not capable enough) could render the entire per-pixel lighting effect including a surface texture in a single pass!

The NV_reflection_vector extension provides texture coordinate generation modes for both the eye-space reflection vector and eye-space normal vector to support this approach. Interpolating an unnormalized reflection vector and normal vector is not ideal. In true per-pixel Phong shading [81], the eye and normal vectors are interpolated and re-normalized per-pixel and the reflection vector is computed per-pixel.


next up previous contents
Next: 11.2.3 Cube Environment Mapping Up: 11.2.2 Dual-Paraboloid Environment Mapping Previous: 11.2.2.3 Advantages and Disadvantages   Contents
2001-01-10