Gamasutra: The Art & Business of Making Gamesspacer
"Ups and Downs" of Bump Mapping with DirectX 6
View All     RSS
August 21, 2018
arrowPress Releases
August 21, 2018
Games Press
View All     RSS
  • Editor-In-Chief:
    Kris Graft
  • Editor:
    Alex Wawro
  • Contributors:
    Chris Kerr
    Alissa McAloon
    Emma Kidwell
    Bryant Francis
    Katherine Cross
  • Advertising:
    Libby Kruse






If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

"Ups and Downs" of Bump Mapping with DirectX 6


June 4, 1999 Article Start Previous Page 6 of 7 Next
 

Using Bump Mapping Effects

The fun begins when we start looking at how we can use bump-mapping techniques to achieve different special effects. Many of the values defined above can be animated, which can create some awesome effects. Some effects that bump maps can create include:

  • Run-time generation of environment maps. The map could be a previously rendered frame, a composite of several lightmaps (if you have more than one light source), or a procedural texture from some sort of noise function (like swirling clouds). Figure 2B illustrates this technique (the sample application was used to generate this screenshot) -- the environment map being bumped is an actual rendered scene.
  • Procedural generatation or modification of a bump map. This could be a sinusoidal function, or it could be used to create things like bullet holes that get composited into the bump map at run time. The sample code demonstrates this as well -- as the waves on the water are procedurally generated, the user can click and drag on the water to generate waves in the bump map that then are used to distort the reflection
  • Animating the BUMPENVMATXX matrix to rotate and scale the texel fetches into the environment map. This could affect the bumpiness of an entire object. Goosebumps could suddenly appear on a character and could be varied just by changing two values in the matrix (just two renderstate calls)
  • Animating the BUMPENVOFFSET and BUMPENVSCALE settings, to modify or animate the luminance of the bumped texel color. This could be used to make highlighted bumpy areas move around on an object.
  • Using filtering and/or MIP-map techniques on bump map textures or an environment map. Interesting effects could be achieved when a player got closer to a bump-mapped object, such as increasing the detail of the textures, so that small perturbations on the surface become more apparent as the player examines an object more closely.

Figure 2. DirectX 6 bump mapping illustration.

Figure 2A. Scene rendered to texture,
which is then used as the water surface.
[zoom]
Figure 2B. Scene rendered to texture,
which is then used as environment map
and distorted with DirectX 6 bump mapping
and a procedural bump map texture.
[zoom]
 
Figure 2C. Same scene as 2B,
rendered in wireframe.
[zoom]

Now that we’ve looked at how to implement DirectX 6 bump mapping, let’s look at a few ideas for effects that could be possible (I say "could" because I haven't tried them all yet) with the above techniques. I have included two demonstration applications that you can download and try: one that shows the embossing technique <emboss.zip>, and another that demonstrates uses bump mapping to create a reflection on shimmering water surface <waterdemo.zip>.

Embossing. Using the embossing example presented earlier in this article, you could create the effect of a spotlight on an object, using a spotlight light map texture. However, unlike the embossing technique that used multiple textures, colored lights could be used instead. If you used this technique in conjunction with vertex lighting, you would likely need to play with the scale and fall-off of the lightmap to get it to match your global lighting model.

Water reflection. An animated, procedural sinusoidal bump map can create very realistic water without a lot of geometry (see Figure 1).

Water distortion. An effect similar to that used in the software-rendered version of Quake (where the entire frame buffer was animated in a sinusoidal pattern) could be implemented. First, you would render the 3D scene to a texture surface. Then using that texture as the environment map, render a couple of triangles to fill the frame buffer and use a sinusoidal patterned bump map to distort the view of the rendered scene, thus bending the entire scene according to the wave pattern.

Circus mirror and lens effects. Using a texture surface as the rendering target, render a scene (or a subset thereof) from the point of view of a mirror in your scene. Then use this rendered scene as the mirror's texture, and use bump mapping to perturb the reflection/refraction according to the values in your bump map. This way the mirror could be bent and warped, like a funhouse mirror, to distort the view of the scene.

Super Mario 64-style portals. An animated texture for the bump map could mimic the effect used in Mario 64 in which the portals that Mario jumped through rippled after he passed them. Nintendo create the effect in Mario 64 using additional geometry.

Better level-of-detail (LOD) transitions. Low LOD models can use bump mapping to hide their low polygon count. For example, if a building has a door handle and window sills that normally stick out from building itself, then when the viewer is far away from the building, the lower LOD version could simply be a cube. This low-detail version of the model could use bump mapping to make the door handle and window sills appear lighted or shadowed as lights moved about in the scene. As the player approaches, you could swap the low-detail geometry for the higher LOD, and turn off bump mapping.

Bullet holes, with Terminator 2-style melting effects. Bullet holes could be created in a surface by compositing in a pre-computed "bullet-hole bump map" onto the objects. Then, just like the silvery-surfaced bad guy in the movie Terminator 2, the bullet holes could melt away by animating the BUMPENVMATXX values toward 0.

Heat distortion rising off the ground. This effect could be done in a similar fashion to the water distortion effect earlier described, but applied to just a subsection of the scene. This may be an instance in which you would want to use a DuDvL format, where luminance in the bump map would taper off toward the top, making the rippling effect fade.

Rippling cloth/clothing/flags. By either procedurally rendering a bump map with an animation, or simply by animating the UV coordinates of a bump map, a character’s shirt could appear to ripple in the wind.

Flight simulator detail textures. This is a similar idea to detail texturing, in which blending a highly tiled texture onto a base texture adds detail -- grossly oversampled textures become more clearly defined as the viewer gets close to them. For example, imagine farm fields viewed from an altitude of 1,000 feet in a flight simulator. At that height, the fields look like a quilt. However, at a height of ten feet (say, when you’re about to crash into the field) the detail adds blades of wheat. Likewise, you could use bump mapping to show 20-foot waves on water from 1,000 feet up, and when the plane swoops down to ten feet in altitude (I never could keep that darned plane in the air), you can make out small ripples or rain drops.


Article Start Previous Page 6 of 7 Next

Related Jobs

Mimic Technologies
Mimic Technologies — Orlando, Florida, United States
[08.20.18]

Senior Lead Software Engineer
Game Closure
Game Closure — Mountain View, California, United States
[08.20.18]

System Software Engineer
Against Gravity - makers of Rec Room
Against Gravity - makers of Rec Room — Seattle, Washington, United States
[08.20.18]

Server Engineer - Rec Room (VR)
Bohemia Interactive
Bohemia Interactive — Mníšek pod Brdy, Czech Republic
[08.20.18]

Game Programmer





Loading Comments

loader image