Sign in to follow this  
Matt Aufderheide

Combining normal maps in a shader

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this