bumpmapping in the darkness

Q/ a while ago on this forum was mentioned a method when the bumped surface is not exposed to the light ie dot(light,normalmap) is less than zero, so instead of looking dark and flat this surface still retains some bumpiness, if i recall there was a picture of the stanford rabbit with a bluish hue (on the dark side) does anyone have any links/info cheers
(i hope this makes sense)

You probably mean “ambient cubemaps” or some variant (interpolating two colors, or two textures or whatever)
For cubemaps it works very simple, just do lookup in the cubemap based on the per pixel normal.
If you use a blurred or low-res cubemap this should give you some bumpy ambient color.


You can also do a dot between the surface normal and the bumpmap in your ambient pass and multiply that with the ambient color. This is just a fake but gives you some bumpy detail in unlit regions.

(Edit: added the other side of the dot)

Originally posted by Lars:
You can also do a dot with the surface normal in your ambient pass and multiply that with the ambient color.
Dot the surface normal with what?

– Tom


Since most light comes from above, you might lerp between two colors based on the y component of the normal alone.

ambient_color = 0.5 * ( above_color + below_color ) + normal.y * 0.5 * ( above_color - below_color );

Originally posted by Tom Nuydens:
Dot the surface normal with what?
I assume he means dot(bumpmap, faceNormal);

Another way to go is to assign the ambient light a “pseudo direction”. A suitable choice would be the direction of the sun since it is the main contributer of ambient light anyway. On backfacing fragments you then subtract the bumpmap dot the direction (or add, since this will of course be negative) times some constant (suitable values are about 0.4). This retains the creasiness of the backfacing surface pretty well. The technique can also be extended to work with shadows.

Yes, only I suggest you use the negative sun direction, that that’s where the most of the indirect light is coming from (unless it’s cloudy), and it’ll give you the nice backlight effect commonly used by traditional artists.


I’m wondering why anyone hasn’t mentioned parallax mapping yet.After all,it was invented by some guy who frequents these forums.

You could just as easily reverse the light vector, reverse the half angle vector, do the dot product and scale it to a “low value”.

You could divide by 10, for example.

parallax mapping works pretty good on textured objects, because polygons not facing the light still get rasterized with a distortion algorithm.
Problems :

  • works best on 2D-textured objects, not to mention it works almost exclusively with 2D textures (not a big deal considering today’s modeling techniques),
  • needs texture-dependant read hardware (GF3/4Ti or higher, Radeon8500 or higher) for simple parallax mapping (only decal and lighting) and needs better hardware (GFFX, Radeon9500 and higher) for advanced effects (cubemap reflection, etc).

Another good technique I’ve heard of for ambient approximation using a main light direction vector is hemispheric lighting gives you both sun and approximation to reflected light.

If you’re going to implement parallax mapping, then you’ll need a height map. And if you have a height map available, you can add a nice little lighting hack by modulating your ambient light with the height. This looks the best on materials with “cracks” such as brick textures, because you’d expect a little more darkness at the bottom of cracks.

Originally posted by dorbie:
Bumpmapping in the dark makes you happy doesn’t it? :smiley: