Baking Normals within other maps?

Hi everyone!

Lately I’ve been investigating a lot in the subject of maps baking and such for using the techniques in Luke’s Escape short film and also for an upcoming tutorial series.

Here is the situation:

I have high-poly mesh and a low-poly mesh. Even though most of the detail of the model is in the high-poly mesh, I still created some little details in a normal map that are not in the highpoly model.

Now the question:

If I want to bake my normal maps, is there a way in which I can bake the actual geometry normals mixed with the detail normals I created? I know this is not a big issue, there are plenty of techniques to mix two normal maps with other software, I just wanted to know if that is possible in Blender.

Because this goes even further: While mixing normal maps is easy, what I was trying was getting the details from a normal map to have their effect when baking an Ambient Occlusion map, as otherwise, only real geometry is calculated for the AO (or any other map).

This is possible to do in XNormal, defining the “Highpoly normals override file” in the low-poly mesh; then XNormal, when baking any map will use that normal map applied to the high-poly mesh. Anyone knows if this is possible in Blender? So far I couldn’t figure it out!

Thank you!

So… you have a hand-made normal map and you need to bake the high-poly detail normal map on top of it? There is a Clear option in the Bake panel. If you disable it, the bake will not erase the current image, thus keeping your hand-made detail but also adding the high-poly detail.

Oh! Didn’t try that one! Will check!

I don’t think that would work to bake those details in a normal map into the AO, right?

Thank you!

Just tried it, but it doesn’t work. When the “Clear” option is disabled, it keeps the existing map, but only in the areas where the new maps aren’t (spaces between the UVs). Thank you anyway! :slight_smile:

I’m afraid it doesn’t work in Cycles (yet?), but you can do it in BI by simply baking the normals as usual (baking at the same time the geometry and the maps).

I’m thinking that can be done, thought i’ve not tested, and wouldn’t be very straight forward…

First, bake the normals from the highres geometry to the lowres geometry as usual, and save that texture.
Second, use the node I published here and connect the highres normals, to the node, and bake the Diffuse Color from the highres to the lowres. And save as a secondary normal.

To join both textures, you can use the VectorMath-Average between the two. (and baking again if you like)

hope it works

Edited: after thinking a bit… it’s probably best to have a very similar UVmap in both objects, because Tangent Normals depend a lot from UVcoords…
or maybe baking the world coords in a EXR file, and then use the node to make the conversion to TangentSpace…:spin: this is something that still requires a lot of testing… :o

Thanks a lot, Secrop! That looks very interesting! I’ll look into the vectorMath-Average to mix two normal maps. What I like about XNormal in this subject is that it treats those base normal maps as highpoly geometry detail to be baked it the lowpoly geometry, so it works great.

PS: The node you posted looks great! :smiley:

If it works, tell us. This is something that can be usefull to others. :slight_smile:

I’ve made a quick test, and apparently, the vector math allows to mix two normal maps. What I’ve notticed, though, is that “Average” and “Add” almost produce the same result, but in both of them, is like for mixing both maps, intensity is taken from both of them, not producing the desired result. It would need a more complex setup. I also tried to mix the images with the mix node and trying all of the modes, but not satisfactory results for now. I guess that with a little bit of normals understanding and some node setup it could be done, but honestly, I’m in the middle of a project and don’t have a lot of time for this kind of tests, so for now I think I will stick with XNormal for this matter :slight_smile:

Thanks a lot for your help! :smiley:

Yahh, Add and Average are pretty much the same… the only difference is that Average is normalized…

About mixing two normal maps… Maybe this can help:


I added a Factor value, so you can control it better.

Oliver, sorry for the misinformation about the Clear option, for some reason I assumed it’d work :frowning:

Secrop, the compositing technique to overlay normal maps is a bit more involved, i.e. the result of your node setup may lead to artifacts due to mixing blue channels of both normal maps. One could use the blue-multiply, red-green-overlay trick in Blender’s Compositor, but they’d have to tackle color management then to properly fetch and save data. The same could probably be done with Cycles nodes as well, I haven’t gotten around to trying it yet though.

You may be right, Stan… I’m going to look closer to the math involved, to check for a better solution…

Edited: Ok, there was something missing in my logic… if we plug a ‘Normalize’ in the end of the node, the result will be correct.

Wait, wait… As far as I understand your setup, you’re unpacking the SecondaryNormal from color data and add it to the (still packed) BaseNormal? That’s definitely not going to work as it should :slight_smile: You could unpack both and then add them like vectors, and normalize, yes, but that’s not going to be entirely correct either: consider, for example, if base normal map is “flat” (8080FF) where secondary is not. You’d expect to only get the effect of the secondary map, yet it’s going to be distorted by adding that first Z. If you try the same, say, in Gimp or Photoshop or compositor, you’ll see what I mean: such “summing” ends up with the loss of contrast in the resulting map.

OK Stan… Let’s go for perfection!! :wink:


1 Like

Wow! I have no idea of what you guys are doing (kind of understand the logic, but looks like you know about the math and process behind normal maps and mixing images xD), but it definitely looks like you’re up to something :smiley:

Will try these setups when I have some time! Thanks a lot for your interest and effort, it’s very appreciated!

Heh, that last setup does a really good job especially on detail intersections. I’d actually have to pen and paper it a bit :slight_smile: Nice one!

I don’t take the credits for the formula! I found it here. But sure it was one of the most beautifull formulas I’ve seen regarding this matter.
It’s basically a quaternion rotation of the second normal by the base normal, simplified by placing parts of the transformation matrix scattered along where they could fit better. :slight_smile:

That link leads to 404 :spin:

it should work now. :wink:
and it’s has very nice informations about other methods also. :slight_smile:

Oh, an interesting read and some great references to boot. Thanks!