Skip to main content
gamedev.net
🔒 Locked

Per Pixel Lighting

Started by Programmer101 0 replies 400+ views
Original Post
Programmer101
Programmer101
How would you go about implementing per pixel lighting? I've read about normal mapping, but I really don't want to do that unless I have to. If so, how do you do that? In all that I've read its been very confusing. I know that you bake the normals to a texture and load it into a shader. Then you have to calculate the normals with tangents or something but thats where I get lost.
51mon
51mon
If you just want to make the diffuse lighting do like this:
(You need to know how to implement a simple shader.)

• Send a render call to render the meshes just the regular way.
• In the vertex shader you just pushing the normals forward in a texture coordinate.
• In the pixel shader you first normalize the normals, because they shrink when they are interpolated.
• Then you use the normal and do a regular diffuse calculation and let that value fill the pixel.

If you want to do bump mapping too, you are half the way. But it regards a little bit more involvement.

Topic Locked

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

Sign in to reply to this topic.