‚ėěThis group consists of all kinds of people from every nation. The aim of this group is to create an enjoyable environment to be creative and having fun with what you do. This group definitely isn't just for people who like to draw, but for people who enjoy any kind of art. So, you can also a story or create some background music, whatever your skill might be. If there are any questions left, just write me a message and I will respond as soon as possible.

Report article RSS Feed Photoshop: Combining normal maps

In this tutorial I will show you two methods in photoshop for merging together two normal maps into one. The first one - the lazy method - is the most famous one, but sadly also quite bad because it destroys color information. So the second method shows you how to properly merge normal maps together so that you get a map with the same quality that CrazyBump or any other 3rd party software would give you. If made into an action, you can merge your normal maps together in just one second.

Posted by Niteshade on Oct 6th, 2011
Advanced Textures.

.: 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:

DOWNLOAD LINK

(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!
Cheers!

Post comment Comments
sydrose
sydrose Oct 6 2011, 10:15pm says:

that is so awesome.

+3 votes     reply to comment
DevinShadowV
DevinShadowV Oct 6 2011, 10:23pm says:

wow

+3 votes     reply to comment
lancer611
lancer611 Oct 7 2011, 7:36am says:

you make it seem so easy, and I'm a programmer xd. gj

+2 votes     reply to comment
Cryrid
Cryrid Oct 7 2011, 4:22pm says:

For the lazy, a handy action for combining can be downloaded here: Rodgreen.com

+1 vote     reply to comment
Niteshade Author
Niteshade Oct 7 2011, 4:32pm says:

His tutorial/action doesn't ADD the blue channel properly though - you get the problem that's in the black-and-white picture in my tutorial.
I'll post a download link to my action though at the bottom of this tutorial.

+1 vote   reply to comment
papercoffee
papercoffee Apr 25 2013, 3:23pm says:

Thank you very much for this...

+1 vote     reply to comment
Guest
Guest Oct 24 2013, 3:04pm says:

This comment is currently awaiting admin approval, join now to view.

Guest
Guest Feb 2 2014, 4:23pm says:

This comment is currently awaiting admin approval, join now to view.

Nightmare106
Nightmare106 Jul 29 2014, 3:38pm says:

Hey, man love your tutorial, definitely useful and explained a lot to me about normals and how they behave in RGB system! :D Anyways, love your tutorial and I will definitely use this knowledge from now on. But am wondering if this is as equally good or at least almost as good as technique I've been using to combine normal maps because it's much more simpler and easier to do (even though it doesn't matter since I use actionscripts for this kind of stuff.) Anyways, this is the technique am using:
Youtube.com
Hopefully Niteshade will see this and respond accordingly because I could definitely use his advice.

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Established
Jun 14, 2010
Privacy
Public
Subscription
Open to all members
Contact
Send Message
Email
Members Only
Membership
Join this group
Group Watch
Track this group
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Groups
3D Artists Group
3D Artists Group Arts & Literature group with 1,180 members
deviantART
deviantART Arts & Literature group with 263 members
Global Union of Arts
Global Union of Arts Hobbies & Interests group with 68 members
UDK Developer's Group
UDK Developer's Group Hardware & Tech group with 694 members