Baking Cycles Procedural Normals to Texture

I suspect you are saving the file with color transformations… Try changing the Render settings in the Color Management panel to ‘NonColour Data’ or ‘Linear Raw’, and save the file again.

In my version of this node setup, if I plug the output of a NormalMap node (and a normal texture), into the node input, the difference between the normal texture and the node output is almost none… Ideally it would be 0, but after three transforms, near 0 is good enough.

Are you sure ? Then why is there a World Space option in the node ?

Those options are for different encodings of normal maps. In the game industry, tangent maps are very common because they are small. But in CG industry you have more formats around…
Anyway, the Normal Map node will not convert a world space vector into a tangent vector.

( ゜〇 ゜)

I left the mix node facs to 0.5 in the nodegroup…
The normals match perfectly now (not the colors but what matters is the normals and they didn’t match previously… Now they do… This is awesome… You rock !)

I think it would be best to provide a blend file containing your node group in the original post to ensure nobody makes stupid mistakes and adds useless posts like me.

the socket’s color in the in/output groups is a bit funny to trick… create the socket with a node that outputs the type of socket you want to have, then plug the input you want. :wink:

I have it as a python node, just waiting for some court decisions to be able to share it, as long with some other nodes… but I think there’s someone who posted this in blendswap(?!)

Are you sure that math is correct? I was reading this on unity manual:

In addition, the values in the texture are treated as having been halved, with 0.5 added.

I tried both 0.5 and 1 and unity still somehow change colors when setting tif texture type to normal map.

edit: Adding 1 is making it worse… With your values i’m getting (0.5,0.5,1) color on flat surface, it should be (0.216,0.216,1) on flat?

There should be no color transformation in normal maps!!!
In a normal map, a pixel represents a Vector, not a color! Applying any color space to a normal map makes no sense! And yes, a flat surface must be (0.5,0.5,1).

I’m getting confused, colors i picked in gimp are different than colors i’m getting in UV/image editor.
In UV editor normal baked flat is (0.502,0.502,1) and output from your node on flat surface is (0.647,0.647,1).
Here is file i made to get these values.
Can check if i’m doing something wrong? Thanks
edit: resolved by PM, had wrong fac values and image should be in linear color space

for those of you who would like to have this node work without need of cycles renderer and be able to work with this in material mode. There is actually a way. The problematic “Tangent” node works only in cycles renderer but it can to be baked to separate image. (values of this node are from -1 to 1 range so you need to add 1 and divide by 2). This then can be plugged into secrop node group in the place of Tangent node. (ofc you need to change back range of values 0 to 1 , to -1 to 1).

any rotation of your uv islands will require to rebake tangent node but thats not a problem since baking is matter of one second.

Connect the normal to color, and bake it, but I don’t know if the gamma affects the data

I(and you as serindipia) confirmed the gamma affects if you bake it as colors.

Put the textures as color data.

Bake nodes(only color)


extract data


please use color data, you are baking it as color, it works for me

her is the example, I baked the normals using linear space, but gamma is required, rare issue. Change between the procedural output and the debake output, looks like the same

https://drive.google.com/open?id=0B0zrGMhduaXIZ1RLajdVRHJLbnc

@wikifry, I don’t really understand what’s going on in that file of yours… and probably you’re not understanding the purpose of the nodegroup posted on this thread (you don’t even have that nodegroup in your .blend, so I don’t know what you’re really trying to do, or talking about).

here’s your file, edited to a point that you only need to bake the emission color to an image file with color space set to linear (the image, not the render, or the display). You need to create an empty image to store the bake, but you can read the manual on how to bake.

http://pasteall.org/blend/index.php?id=45997

I had to reset your exposure and gamma values. They are not supposed to be changed for this nodegroup to work, since exposure and gamma mean nothing to vectors.

The result now looks as expected.

Thanks Secrop

It works great! Together with unity Standard Shader Emulator by Soupertrooper it makes creating game assets 10 times quicker and easier. https://blenderartists.org/forum/showthread.php?374544-Shader-Pack-Unity-standard-shader-in-blender-cycles