Question about normal maps

Started by
5 comments, last by SimmerD 18 years, 8 months ago
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
AtlasDeveloping Genetica, a tiling / seamless textures generator
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 :-/
enum Bool { True, False, FileNotFound };
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
AtlasDeveloping Genetica, a tiling / seamless textures generator
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.
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).
Thank you!
AtlasDeveloping Genetica, a tiling / seamless textures generator
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...

This topic is closed to new replies.

Advertisement