In our new pipeline we need to merge our texture into two. For our normal map we have only space to use two channels and we need to calculate the blue channel. I wonder - do any of you guys have the magic formula?
This kind of math is way out of my league, but our programmers seems to be stuck. I’m using Shader FX to visually the results.
This is how far we come:
z = square(1- ((2x-1)^2+(2y-1)^2) )
This formula have given us the closest result, but the new blue channel (comparing to the original in the texture) have a higher contrast (the white is white, but the gray is a bit darker). We tried to gamma correct the image (thinking maybe Photoshop where messing things up) but it got worse.
The problem is when we use the new, calculated, blue channel (using the formula above) with this:
x^2+y^2+z^2=1
The added result do not become fully white (some pixels of the image do not add up to white). We think we might have some problems with some normal maps not being correctly normalized. Our artist using all kinds of programs to generate their normal maps. How can we solve this?