Jump to content
  • Advertisement
Sign in to follow this  
Atlas

Question about normal maps

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

My understanding is that there are two conventions for what range the blue channel of a normal map occupies. One convention has the blue channel taking the full range 0 to 255, while the other convention uses the range 128 to 255. Could someone please tell me which of the two conventions is more common in game development? Thank you very much! Atlas

Share this post


Link to post
Share on other sites
Advertisement
There aren't even conventions about which channel corresponds to which of T, N and B, much less how the channels are scaled/normalized.

The convention you should use is the convention your tools use, or the convention you engine uses -- ideally, they're the same :-/

Share this post


Link to post
Share on other sites
I'm working on a normal map generating tool that is intended for use by other game designers. For that reason I don't have a specific engine that I'm writing this for, and am trying to make sure that the results are compatible with the needs of as many game developers as possible, without overcomplicating things.

Based on the normal maps I have come across so far, things seem to be relatively standardized. The red and green channels always seems to contain the X and Y components of the normal vectors, respectively, and map the values [-1, 1] to [0, 255]. For the blue channel I have seen two variations. Sometimes they map the Z component values [0, 1] to [0, 255], and sometimes to [128, 255]. And I am wondering if anyone knows which of these two variations are more common among game engines.

Unfortunately I don't have extensive experience working with game engines myself, so if there are any other normal map-related details or variations that I should be aware of to make sure my tool is compatible with what engines need, please let me know!

Thank you very much for any help you can offer.

Atlas

Share this post


Link to post
Share on other sites
You should just make it possible to choose which convention to use. Also be able to choose whether or not to include the z value at all (you can calculate it based on the fact that the normal is unit length). With those types of normal maps you only need 2 channels, in which case the engine can pack more data into a normal map (or even another normal map).

So basically, give the end-user the ability to choose as many options as possible for your application.

Share this post


Link to post
Share on other sites
If its an object-space normalmap then you'll get arbitrary (0-255) values in Z. However if its a tangent-space normalmap you're z values will be positive (128-255). So first you need to figure out if you will be doing tangent space normalmapping (most likely) or object-space normalmapping (which requires unique normalmaps for every model).

Share this post


Link to post
Share on other sites
Come to think of it, Not using the whole range of z in tangent space normal maps is a waste.

It would be a more expensive shader, but you could pack the [0..1] range of tangent space z into [0..255] instead of [128.255] to gain an extra bit of precision.

Of course, you could just derive the z completely instead, but that would be a bit more expensive...

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!