Jump to content
  • Advertisement
Sign in to follow this  
Programmer101

Per Pixel Lighting

This topic is 4259 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

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!