Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
The grayscale image not quite halfway down the page, under "Normal Maps Components". That image contains the channel info for the tangent map example a little farther up.
I made a new image without that blue channel and used the script to try and modify it to replicate the blue channel of the original.
Both Source and that normal map compress the Z component such that a value of less than 128 is assumed to be facing into the model.
Colour dropping some points on the map, some example values are 57 207 196, which add up to a vector of 1.28 if you take it that the Z channel is directly encoded, but 0.97 if you say that it's compressed. The latter is significantly closer to a properly normalised value that it seems that's where the mistake lies.
Try something like sqrt(1-((4*r^2-4*r+1)^2+(4*g^2-4*g+1)^2))/2+0.5 (EDIT: As Episoder says, this is wrong. See my later post for a better answer) to compress it in the same way as the other vectors, then see if it matches.
You can just decompress linearly as (channel * 2) - 1 to get a range between -1 and 1, which is what you want, anyway.
Rethinking it, I think you want:
sqrt(1-((r*2)-1)^2+((g*2)-1)^2)/2+0.5
Still, what I said before still seems to be correct. The blue channel is compressed.
This method won't actually allow a normal to lie flat against the surface, so if you're trying to create normal maps from scratch, I don't particularly recommend it.
Looking at this post[discourse.techart.online], it seems you were correct about the compression part. The equation given in that post gives a much better result, although the difference is still nonzero, if barely. Not sure how much closer I can get. This[i.imgur.com] is the difference between my new blue channel and the one given. Not sure where the noise is coming from but it's so close.
New expression for the moment is sqrt(1-((2r-1)^2+(2g-1)^2))/2+0.5
Despite being the same at first glance as the one you posted, it gives different results. I think placement of parenthesis is making a difference here.
Edit: Seems that forum link triggered Steam's anti-spam filter.
discourse techart online/t/how-to-calculate-the-blue-channel-for-normal-map/4436/7
The value I eye droppered before totalled to 0.97, so the normal map wasn't exactly perfectly normalised in the first place, so those differences will show up as noise as the reconstruction is assuming a perfectly normalised total.
https://i.imgur.com/kPy1TLC.jpg