Dotproduct3 Bump Mapping with 3D
Lightmapping on the Radeon®
|
| |
The RadeonDotProduct3 sample uses EXT_texture_env_dot3,
ATI_texture_mirror_once,
ARB_texture_cube_map, EXT_texture3Dand
to demonstrate per-pixel lighting effects possible in
OpenGL®. It demonstrates DOT3 Bumpmapping, 3D Lightmap,
and shows the difference when using a cube map for normalizing
the vectors.
For more on 3D light mapping as well as 3D texturing in
general, check out the
Radeon® 3D Texture Mapping Tutorial.
Figure 1 shows the final result.
|
| |
|
| |
Figure 1 - Final Dot3 Bumps with 3D Lightmap
|
| |
The process begins by taking the vector from each vertex
to the light converting it into tangent space (the coordinate
space of the base texture). This vector is packed into
the color when a cube map is not used. When using a cube
map for vector normalization the light vector is placed
in the texture coordinates. These coordinates are used
to reach into a pre-computed cube map in which each face
of the cube contains a normalized vector pointing outward
from the center of the cube. The results of these computations
are shown in Figure 2
|
| |
|
| |
Figure 2 - Light Vector displayed as color
|
| |
The dot product of this light vector and a pre-filtered
height map (the normals in texture space, shown in Figure
3 as color) is computed using ATIX_texture_env_dot3 to
produce the initial lighting. Figure 4 shows the results.
|
| |
|
| |
Figure 3 - Pre-Filtered Height displayed as
color
|
| |
|
| |
Figure 4 - Light Vector DOT3ed with Pre-filtered
height map
|
| |
The results of this are modulated with the 3D lightmap
(shown in Figure 5) and the base texture (shown in Figure
6) to produce the final image shown as Figure 1. The 3D
lightmap is generated as one quadrant of a sphere and
then mirrored using ATI_texture_mirror_once.
|
| |
|
| |
Figure 5 - Result of 3D lightmapping
|
| |
|
| |
Figure 6 - Base Texture
|
| |
- RadeonDot3Bump3DLight Controls
-
- M - Show stages of bump and lightmap process
- T - Cycle through the different textures
- V - Toggle display of light per-vertex vectors
- C - Toggle display of tangent space per-vertex
coordinate systems
- W - Toggle display of wireframe
- [UP] - Move light further from object center
- [DOWN] - Move light closer to object center
- [LEFT MOUSE] + Mouse - Rotate Object
- [RIGHT MOUSE] + Mouse - Rotate Light
- [SPACE] - Stop light motion
- [ESC] - Quit
|
| |
Downloads
|
| |
Note: The source code and media should be unzipped
into the following recommended directory structure to
ensure you can easily compile and run the executable.
Radeonxxxxxx.zip -> x:\atiddk\OpenGLmedia.zip -> x:\atiddk\mediaraw.zip
-> x:\atiddk\media
RadeonDotProduct3.zip
media.zip
Back
to Samples Page
|
| |