.: Intro :.
This is an advanced tutorial: you should be very familiar with photoshop and 3D modelling (texturing) in general. It is also strongly recommended that you know how to create an action inside photoshop, so you can create a macro for merging NM's instead of Photoshop. It would also help if you know the theory and technology behind normal mapping.
.: The lazy method :.
Start out by opening your two normal maps inside photoshop. Move one of them over to the other, or take two equal-sized cuts from both of them and paste into a new picture. Rename the top normal map "NM 1" and the bottom one "NM 2".
Here's my two normal maps:
The easy and lazy method for combining them is to just set the blend mode of the top layer to: "Overlay"I say "lazy" method because once you know the proper method, and have made a macro/action for it: there is no need to use this first method. Also, this method destroys color information in the blue channel, and I'll show you why that's bad. But before I move on to the proper method, lets go through some normal map basics:
.: Theory :.
A typical tangent space normal map has three channels:
R - Red: Which represents the X values of the normal in a -1 to +1 range
G - Green: Which represents the Y values of the normal in a -1 to +1 range
B - Blue: Which represents the Z values of the normal in a 0 to +1 range
What does this mean?
To explain this better, we must be clear about what a surface normal is: A surface normal to a flat surface is a vector that is perpendicular (90 deg) to that surface. On a non-corrupt model, the surface normals are pointing outwards from the mesh, kinda like the spines of a hedgehog. In computer graphics, normal vectors are attached to both vertices and polygons.
The normal is used to determine what orientation a surface has toward a light source (flat shading), or the orientation of each of the vertices in order to fake a curved surface (phong shading). In other words: the normal determines how the light will bounce off the surface. So with normal mapping we can shift pixels to fake geometry that doesn't actually exist on the mesh.
On a height map (aka Bumpmap) - which only has one channel with a 0 to +1 range - the channel (color) value only determines a displacement along the existing, unchanged, normal vector of the face. This means that heightmaps only store height intensity in direct relation to the viewpoint of the camera. The 0 to 255 color range is a representation of the 0 to +1 normal vector range (Z).
A normal map on the other hand, has three channels. One for manipulating the normal vector along X (red), one along Y (green) and one with the same functionality as a heightmap (blue).So yeah basically: since not all three channels are storing data in the same way we need to make sure we handle each channel independently when merging. But even more important though is that the red and green channels has values in both the negative and positive range (-1 to 1 - represented as channel color values 0 to 255) unlike the blue channel. Therefore they need to be - like I said - treated differently.
To make things more clear: A base normal has the value 0 0 1 - it's perpendicular (90deg) to the surface it originates from. If we represent 0 0 1 as a color on a normal map, then our value would be 127 127 255. Remember that red and green have both positive and negative values, so 0 here is either 127 or 128 (both are in the middle of the 0-255 range).Now, you might not understand all this (or maybe you do?) but at least we can agree on one thing: a normal map is complex, and to just use one blendmode for all colors would be reckless and plain stupid. But "why is overlay so BAD?" is still a good question. The answer is that it does not properly merge the blue channel - in fact, it's not even CLOSE. Try it yourself:
Make a document with both your normal maps in them. Then under the channels window you turn on "Blue" instead of RGB and then you change the blend mode of the top normal map to "Overlay". The result will be a lot of white - a loss of color information. It's destroyed, and the result of this is displayed in the bottom pic of this tutorial.
.: The proper method :.
Inside your document (where you have both your normal maps ofc), rename the top normal map to "NM 1" and the bottom one to "NM 2".
Duplicate "NM 1" and rename the copy to "NM 1 ADD"
Rename "NM 1" to "NM 1 SUB"
Thats the preparations. Time to get to work!
Select "NM 1 ADD"Go to Image -> Adjustments -> Levels (yes, no adjustment layer: these changes should be permanent anyway)
Set the Red input to 128 1 255
Set the Red output to 128 255
Set the Green input to 128 1 255
Set the Green output to 128 255
and last, set the Blue output to 0 0
What did we just do? We removed the negative R and G values from "NM 1 ADD" and we removed the blue channel entirely. Now we are going to remove the positive values from "NM 1 SUB"
Select "NM 1 SUB"
Go to Image -> Adjustments -> Levels
Set the Red input to 0 1 127
Set the Red output to 0 127
Set the Green input to 0 1 127
Set the Green output to 0 127
DON'T touch the Blue channel
Now we need to find out how much the ADD and SUB layers deviate from the default normal vector value (127 127 255) and shift the colors of these layers so they match each other. We need to add this value to the SUB layer and subtract it from the ADD layer to get the proper offsets for each layer. So next up - the mystery tool, that not even I understand entirely: The channel mixer
Select "NM 1 SUB"
Go to Image -> Adjustments -> Channel Mixer
Set the red channel to -100% RED, and it's constant to +50%
Set the green channel to -100% GREEN, and it's constant to +50%
Set the blue channel to -100% BLUE, and it's constant to 100%
The channels are now properly shifted/offsetted
Now select "NM 1 ADD"
Go to Image -> Adjustments -> Channel Mixer
Set the red channel to +100% RED, and it's constant to -50%
Set the green channel to +100% GREEN, and it's constant to -50%
Leave the blue channel - it doesn't contain any blue colors anyway (remember that we removed the blue colors entirely from this layer earlier?)
As it is now, "NM_1_SUB" contains R,G and B vector information and "NM_1_ADD" contains only R and G vector information. Time to merge them together:
Select "NM_1_SUB" layer and set the blend mode to "Subtract"
Select the "NM_1_ADD" layer and set the blend mode to "Linear Dodge: Add"
Almost done, but there's a problem. If you look on the blue channel you will see that that the color is darker at intersections, meaning that even though the "NM 1" and "NM 2" have the same blue values here, it gets lowered by the blend mode. We can fix this by breaking up the "NM 1 SUB" layer into two parts: one dealing with Red and Green and one dealing with Blue.
Select "NM 1 SUB" again and set the blend mode back to "Normal".
Then duplicate the layer and rename the copy "NM 1 SUB RG".
Rename the original "NM 1 SUB B".
Select "NM 1 SUB RG" and then select it's Blue channel.
Press Ctrl+A to select the entire canvas. Then pick a black color and press Shift+F5 to fill this channel.
Then select "NM 1 SUB B" and select the Red and Green channels (hold Shift to select both).
Press Shift+F5 and fill those channels with black.
Now set the blend mode of "NM 1 SUB RG" to "Difference" and the blend mode of "NM 1 SUB B" to "Exclusion"
Your merged normals might look the same as before, but have a look at the blue channel. Intersections are no longer darker.
But what about CrazyBump?
CrazyBump is a great tool because it offers you very good control over what you are doing. So the reason you want to be able to merge normal maps together inside of Photoshop is simple: SPEED. If you make an action out of this - which I strongly recommend - then it's 10 or even 20 times faster (if not faster) than opening up CrazyBump, loading your normal map, opening the mixer, loading another map, saving everything...
Finally, here's my different results (the lazy method, the proper method and merging inside of crazybump) being previewed inside CrazyBump.
Notice how the lazy method seem to lack intensity. That's because the blue channel data was destroyed by the Overlay blend mode.
Here's my Photoshop action:
(import it in Photoshop and then just rename the TOP normal map layer to "NM 1" without the quotation marks, and the BOTTOM normal map layer to "NM 2" and you are ready to go.
Hopefully you learned something!