# How to get edges and normal map from 3D model?

I want to extract edges and normal maps from the 3d model using freestyle. However, my rendered normal map looks like this

But it should look like this.

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.

I think I should render matcap in shading properties, but I have no idea how to render like matcap.

• The thing you want is called world normal map (global normal map), and depends on how the normal vector is stored in map, the color can be black in certain case. You should specify your question a little bit more on what you want. – Hikariztw May 15 '19 at 5:01

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?