there are two problems, there's no blue channel in the rendered normal map. And there is a shaded area which is black even lamp exists there.
Normal maps in Blender store a normal as follows:
- Red maps from (0 - 255) to X (-1.0 - 1.0)
- Green maps from (0 - 255) to Y (-1.0 - 1.0)
- Blue maps from (0 - 255) to Z (0.0 - 1.0)
Since normals all point towards a viewer, negative Z values are not stored (they would be invisible anyway). In Blender we store a full blue range, although some other implementations also map blue colors (128 - 255) to (0.0 - 1.0). The latter convention is used in “Doom 3” for example.
If you want to achieve the default Blender normal map definition (z start from 0.0 instead of -1.0). You need to defined what will happen if
-1 < z < 0
Below is two examples for how to calculate it by node editor:
Is the first one you are asking for?