# How to convert object space normals to tangent space?

I'm trying to experiment a workflow where I can manually paint normals to create stylized shading for a model.

Painting on the model, I want to use object-space normal, as it's easier to work with, but it's a problem that I end up with tangent space normals. Ideally I would want to just convert it back to tangent space in the shader.

At the very least I have to know whether or not it's possible to do what I'm trying to do?

The simplest way to do such a conversion is to calculate the dot products between the Object_Space_Normal and the Tangent plane, and then 'normalize' the result to RGB.

$$\vec{Tg}_N = 0.5 + \begin{bmatrix} \vec{Tg} \cdot \vec{N}_{obj} \\ (\vec{N} \times \vec{Tg}) \cdot N_{obj} \\ \vec{N} \cdot \vec{N}_{obj} \end{bmatrix} / 2$$

This is the main process when working with vectors in World space.

In the case where your Normals are Object normals encoded into RGB, then you need to convert them first to world as in the following example: • Hi, yoür formula was really hard to read. I tried to convert it with proper formatting, but did I possibly mess up? Could you correct it, please? – Leander Aug 11 at 9:31
• @Leander, it looks ok... I'll post the equivalent in nodes, for people less comfortable with math notation. – Secrop Aug 11 at 9:34
• I'm especially confused because it says 0.5 * [...] / 2 which cancels each other out and results in [...]. – Leander Aug 11 at 9:38
• @Leander, it's supposed to be a sum.. my fail, but corrected. :) – Secrop Aug 11 at 9:39
• @meatandmahjong, I see now what you're trying to do... I'll update my answer later today, but you need to use the NormalMap node with your Texture, before plugging it into this node setup. (or 2*Tex-1) – Secrop Aug 11 at 14:57