1
$\begingroup$

I have a normal map texture where the blue channel is used to store some other map of information since it is normally used in a program which calculates the blue channel from the red and green channel automatically. Now I want to use that same texture in Blender and figured it shouldn't be too hard to do the math in the node editor so it jus works regardless of which normal map I use. However, it doesn't seem to work. The result I get has shading issues quite similar to how it looks without any information in the blue channel. This is despite me having found the formula and I believe created it accurately in the node editor. Does anyone have any idea why this wouldn't create the desired results?

The formula I found to generate the blue channel is "B = sqrt(1 - ((R * R) + (G * G)))"

My nodesetup recreating the formula "B = sqrt(1 - ((R * R) + (G * G)))"

$\endgroup$
  • 1
    $\begingroup$ Blender uses OpenGL format for normal maps. Maybe you need to invert the green channel? $\endgroup$ – Jackdaw Aug 9 '19 at 4:25
  • 1
    $\begingroup$ Also... the texture node should be set to use Linear or Non-Color Color Space. $\endgroup$ – Jackdaw Aug 9 '19 at 4:46
  • 2
    $\begingroup$ In case somebody wonders why you can drop the blue channel: If it's a tangent space normal map it only stores vectors in the hemisphere with a positive Z component. Since we also know that it's a unit vector, we can retrieve the Z component by subtracting the squared components of X and Y from 1, because we know the unit vector has a magnitude of 1. sqrt(X^2+Y^2+Z^2)=1 can be transformed to Z=sqrt(1-X^2+Y^2). This trick doesn't work for object space normals because they store the full unit sphere. That's the point I missed when I wrote my answer late at night :) $\endgroup$ – Robert Gützkow Aug 9 '19 at 6:36
  • $\begingroup$ Thanks for the suggestions guys. I changed the color space to Non-Color which changed the result a bit but still doesn't look how it should. The engine these normal maps are used in is OpenGL so shouldn't have to invert the green channel. I tried anyway but didn't fix it. $\endgroup$ – Karl Høybye Aug 9 '19 at 17:05
1
$\begingroup$

enter image description here

I managed to generate the Z channel in the normal map according to this scheme (taken from UE4). In the "normal" texture, everything is as usual, only the Blue channel, replaced by roughness.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.