Jump to content
  • Advertisement
Sign in to follow this  
Matt Aufderheide

Combining normal maps in a shader

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

I have 2 or more normal maps that I want to combine in pixel shader. Obviously just lerping them or multiplying them doesn't work correctly...there ought to be some "correct" way to do it. Assume that the actual vertex normal is always facing up, and that the normal maps and lighting are in tangent space.

Share this post


Link to post
Share on other sites
Advertisement
you can lerp between the 2 normals. Just don't forget to normalize the result

Share this post


Link to post
Share on other sites
I found that in most cases, simply adding and renormalizing the two normals looks goog enough. Depends on what you intend to do with the normals, though.

Share this post


Link to post
Share on other sites
The mathematically correct way to do this is very simple. Don't normalize the normals when creating the normal maps. Then in the shader, add them together and then normalize. This will give identical results to what adding the two height maps together first, and then creating a normal map from the result, would have done.

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!