07.01.2013 Views

3D graphics eBook - Course Materials Repository

3D graphics eBook - Course Materials Repository

3D graphics eBook - Course Materials Repository

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Cube mapping 34<br />

Advantages<br />

Cube mapping is preferred over other methods of environment mapping because of its relative simplicity. Also, cube<br />

mapping produces results that are similar to those obtained by ray tracing, but is much more computationally<br />

efficient – the moderate reduction in quality is compensated for by large gains in efficiency.<br />

Predating cube mapping, sphere mapping has many inherent flaws that made it impractical for most applications.<br />

Sphere mapping is view dependent meaning that a different texture is necessary for each viewpoint. Therefore, in<br />

applications where the viewpoint is mobile, it would be necessary to dynamically generate a new sphere mapping for<br />

each new viewpoint (or, to pre-generate a mapping for every viewpoint). Also, a texture mapped onto a sphere's<br />

surface must be stretched and compressed, and warping and distortion (particularly along the edge of the sphere) are<br />

a direct consequence of this. Although these image flaws can be reduced using certain tricks and techniques like<br />

“pre-stretching”, this just adds another layer of complexity to sphere mapping.<br />

Paraboloid mapping provides some improvement on the limitations of sphere mapping, however it requires two<br />

rendering passes in addition to special image warping operations and more involved computation.<br />

Conversely, cube mapping requires only a single render pass, and due to its simple nature, is very easy for<br />

developers to comprehend and generate. Also, cube mapping uses the entire resolution of the texture image,<br />

compared to sphere and paraboloid mappings, which also allows it to use lower resolution images to achieve the<br />

same quality. Although handling the seams of the cube map is a problem, algorithms have been developed to handle<br />

seam behavior and result in a seamless reflection.<br />

Disadvantages<br />

If a new object or new lighting is introduced into scene or if some object that is reflected in it is moving or changing<br />

in some manner, then the reflection (cube map) does not change and the cube map must be re-rendered. When the<br />

cube map is affixed to an object that moves through the scene then the cube map must also be re-rendered from that<br />

new position.<br />

Applications<br />

Stable Specular Highlights<br />

Computer-aided design (CAD) programs use specular highlights as visual cues to convey a sense of surface<br />

curvature when rendering <strong>3D</strong> objects. However, many CAD programs exhibit problems in sampling specular<br />

highlights because the specular lighting computations are only performed at the vertices of the mesh used to<br />

represent the object, and interpolation is used to estimate lighting across the surface of the object. Problems occur<br />

when the mesh vertices are not dense enough, resulting in insufficient sampling of the specular lighting. This in turn<br />

results in highlights with brightness proportionate to the distance from mesh vertices, ultimately compromising the<br />

visual cues that indicate curvature. Unfortunately, this problem cannot be solved simply by creating a denser mesh,<br />

as this can greatly reduce the efficiency of object rendering.<br />

Cube maps provide a fairly straightforward and efficient solution to rendering stable specular highlights. Multiple<br />

specular highlights can be encoded into a cube map texture, which can then be accessed by interpolating across the<br />

surface's reflection vector to supply coordinates. Relative to computing lighting at individual vertices, this method<br />

provides cleaner results that more accurately represent curvature. Another advantage to this method is that it scales<br />

well, as additional specular highlights can be encoded into the texture at no increase in the cost of rendering.<br />

However, this approach is limited in that the light sources must be either distant or infinite lights, although<br />

fortunately this is usually the case in CAD programs. [4]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!