I was exporting an object to another program, and I needed to bake all my textures which were heavily procedural.
For most of them, no problem; but my Normals continue to bake flat!
It looks that baking normals in cycles is just for transfer the surface curvature of an highres object, which I don’t have.
So I came out with this helper node, that transforms Normals in WorldCoords to Tangent, so I can bake them and use them in whatever software I want.
Now I can use my Bump map made in Cycles, in other programs!
Hope its usefull for you all
Happy bl
Edited
I’ve updated the first image with the corrected node setup (a small error pointed out by hyyou). Now the normals are not inverted.
And to avoid color space transformations in the result texture, I recommend you to save file in EXR or TIFF format.
Edited #2
I’ve finally turned this nodegroup into a python node, for anyone lazy enough to build this.
One can find it in my PythonNodes utility addon, and here’s a screenshot of it:
Could you please explain how to build the helper node? I cannot find the Group Input (WorldNormal), and the Group Output (TangentNormal) nodes. Once I build that helper node, how do I group it so that I can use it in the next section where I bake the Diffuse?
just create all the other nodes. When done, select the nodes and group them (CTRL+G). This will enter into that group and give you that greenish backgroung, and the GroupInput/GroupOutput nodes. They will only have an unassigned socket, that you can use to drop input and output connections. If you press N while inside the group, the Properties Toolbar will show, and in the Interface section you can name the inputs and outputs (in my case i named them ‘WorldNormal’ and ‘TangentNormal’ but its a matter of taste ;)).
When ready, press TAB to exit the group, and you’ll end with a simple node just like the yellowish node on the second image. (the color will not be yellow, I’ve changed it just to make the node more visible)
Node Groups are a very powerfull feature in Cycles, check here for more information
Secrop, thanks so much for your help and patience! I was able to make a normal map for the rock texture I created in Cycles nodes. I will play around for ways to use the normal map in the BGE. I’m learning ever day. Thnaks again.
I recreated this node http://imgur.com/79fpBpy But when i use it color that should be flat (r: .5, g: .5, b: 1) they turn out lighter (r: .73725, g: .73725, b: 1). Edit: Found the anwser, changing the texture from sRGB to Non-Color helped.
Hey all, just to say that the inputs from the crossProduct node should be switched!!
Normal on top and Tangent on the bottom.
(@hyyou, thanks for pointing it out)
About the glitch in hyyou’s file, I checked it and the problem is actually from the bump node… lowering the strength/distance on the bump node reduces the glitch, but it still remains there…
And apart from the UV seams, there are also some ‘terminator problems’ and a solution could be to subdivide the mesh a bit more.
Don’t know really how one could solve this, or even if there’s any solution…
The normal map node transforms vectors in tangent space into vectors in world space. This setup does exactly the opposite, transforming world vectors into tangent space.
And the cross product is a function inside the vector math node.
Did i get you right? You have your object with procedural bumps and you want to bake that? And the following didn’t work?:
-create a new image in the U/V image editor in order to bake onto.
-in the node editor add an image texture node. You don’t need to connect it to anything, but it has to be active. As image you choose the one you just created.
-bake the normals (not having checked “from selected to active”!)
oh, and if you insist on sticking to your node setup, try this:
In the “scene”-tab (between “Render layers” and “World”), under “color management"→"Render"→"View”, change the setting from “Default” to “Raw”. That makes the normal map crisper.