Skip to main content
GameDev.net gamedev.net
🔒 Locked

Normal Maps

Started by Prozak May 14, 2004 at 7:43 AM 4 replies 1.6k views
Original Post
Prozak
Prozak
Where can I find decent tutorials on creating and using your own vertex/pixel shaders for normal maping? Thanks for sharing Salsa cooked it, your eyes eat it!
[Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD][My DevDiary]
[Yann L.][Enginuity] [Penny Arcade] [MSDN][VS RoadMap][Humus][BSPs][UGP][NeHe]
"our stupidity allways comes back to bite us in the ass... in a white-shark sort of way..." - Prozak
JohnBolton
JohnBolton
Did you try Google? I did a search on "tutorial vertex pixel shader normal map" and got 2860 hits -- the first one is titled "Direct3D Tutorial 14: Dot3 Bump Mapping".
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
ngill
ngill
Normal mapping is pretty simple..

it''s just a per-pixel lighting shader in which you look up the normal from the texture instead of having an interpolated normal.
Namethatnobodyelsetook
Namethatnobodyelsetook
quote:
Original post by ngill
Normal mapping is pretty simple..

it''s just a per-pixel lighting shader in which you look up the normal from the texture instead of having an interpolated normal.

Not quite. As soon as you rotate objects the normals in those maps are wrong. In fact, using a standard normal map, as soon as a face''s normal isn''t (0,0,1), it''s wrong.

This is where the S and T tangent vectors come into play. Using S, T, and Normal you can transform the light vector into tangent space (ie: move it to the face/texture''s point of view). It''s the light vector in tangent space that you want to dot3 with your normal map.

nVidia has sample C code for generating S, T, and SxT vectors, and their effects browser shows the shader code involved.

LucasMeijer
LucasMeijer
That''s not quite nesicceraly the best way to go about things. You can handle rotating object just fine by rotating the light vector into objectspace, instead of having all normals stored in tangent space.

You only really need tangent space normals in your normalmap if you want to use normalmapping on skinned characters, whose mesh actually deforms.

Tangent space normals have the nice property that they can be paletized more efficiently, but you don''t need to have them to support rotating objects.

Bye, Lucas
Namethatnobodyelsetook
Namethatnobodyelsetook
quote:
Original post by LucasMeijer
You only really need tangent space normals in your normalmap if you want to use normalmapping on skinned characters, whose mesh actually deforms.

Yeah, ok. That make sense. So bumpmapping your world really is much simpler than I thought... the trick is creating appropriate normal maps, since the only tool I''ve used (nV photoshop plugin) assumes you''re making bumps from (0,0,1).

This makes it harder to share maps between objects, but usually that won''t be an issue.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.