It sounds like you may have gotten the use of the normals and the storage of the normals mixed together. Although the shader will remap the texels in your map from 0-1 RGB values to -1 > 1 vector components, that’s a matter for interpretation; when actually reading the textures your values are just 0-1. So you probably don’t want to use 2x -1 / 2y-1 to calculate the z, your want to calculate your normalized pixel from the 0-1 values in the raw texture.
If you use pre-normalized maps:
- The normal maps need to be stored in a linear format without gamma correction.
- The original normals were normalized before the blue component was removed
If both of those are true, B is just sqrt(1 - (sqrt® + sqrt(G))). So, for example, a pixel with a straight up normal would be (.5, .5, .707) in the original, then stored as (.5, .5) and reconstructed as sqrt (1 - (.25 + .25) ) or sqrt (.5) which is .707
If your normal maps are NOT prenormalized, you won’t be able to reconstruct the blue channel – you’d have to store it explicitly some how.