Archived

This topic is now archived and is closed to further replies.

Bump mapping with an infinite light source

This topic is 4947 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I''ve seen the tutorial about bump mapping which uses tangent space and normlization cube maps and all that strange witchcraft. My question is, if I''m using an infinite light source, then most of that tutorial doesn''t apply (according to my limited understanding of how he magically gets the bump mapping to work). For example, finding a light vector in object space doesn''t need to be done because the light has no coordinates, per se. Is there any tutorial for doing simple bump mapping with an infinite light source and a normal map? It seems like it ought to be pretty simple with the DOT3 extension, but I can''t seem to suss out the right sequence of commands to get it to work. My problem is that I''m easily daunted by 20 page "simple tutorials" on how to bump map with all kinds of complicated, seemingly unecessary math. If that''s the only way to do it then I''ll probably end up giving up on the whole thing. Thanks, -Jeremy

Share this post


Link to post
Share on other sites
Bumpmapping effectivly boils down to doing a dot product (DOT3) per pixel, in pretty much the same way that regular vertex lighting does the dot3 per vertex and interpolates between them.

The idea is that you''re going to encode your surface normals (x,y,z) into a texture''s rgb (your normal map) and the light direction as another rgb (either via a vertex colour or another texture). Directional, infinate light sources make the whole thing much easier.

Ok, assuming your normal map is in world coord space then its dead easy - your light vector just goes straight into your vertex colour, and you set your texture mode to do a dot3 between the vertex colour and the normal map (and probably multiply the resulting intensity by an actual colour texture). You can nab that from pretty much any bumpmap tutorial.

If your bumpmap is in object or tangent space (more common) then you need to transform your light vector into tangent space, *then* put the resulting vector into your vertex colour. At this point you may need a normalisation cube map (because the interpolation of the vertex colours means they''re no longer length of 1) but you can add that later.

Share this post


Link to post
Share on other sites