{"id":217,"date":"2007-09-09T19:48:28","date_gmt":"2007-09-10T02:48:28","guid":{"rendered":"http:\/\/rodgreen.com\/wordpress\/?p=4"},"modified":"2007-09-09T19:48:28","modified_gmt":"2007-09-10T02:48:28","slug":"combining-normal-maps-in-photoshop","status":"publish","type":"post","link":"https:\/\/www.rodgreen.com\/?p=217","title":{"rendered":"Combining Normal Maps in Photoshop"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" alt=\"Normal map Sample\" class=\"size-full wp-image-5\" height=\"169\" src=\"http:\/\/rodgreen.com\/wp-content\/uploads\/2008\/04\/normalsample.png\" title=\"Normal map Sample\" width=\"300\" \/> This tutorial will outline the best way I&#39;ve found to &#39;add&#39; two normal maps in photoshop. This method specifically adds two normal maps it doesn&#39;t average, subtract or multiply. <!--more-->Basic Concept:<\/p>\n<blockquote><p>To combine two normals together (normal map A to normal map B) you need to add the positive components and subtract the negative components.<\/p><\/blockquote>\n<p>Anatomy of a normal map:<\/p>\n<blockquote><p>The typical RGB normal map (not a DXT5) is broken up into 3 channels:<\/p>\n<blockquote><p>Red Channel which represents the X values of the normals in a -1 to 1 range Green Channel which represents the Y values of the normals in a -1 to 1 range Blue Channel which represents the Z values of the normals in a 0 to 1 range<\/p><\/blockquote>\n<p>\tNotice how the blue channel doesn&#39;t have any negative values, this is because the Z value of a normal cannot be negative &#8211; it must point outward. If you load up a RGB normal map image into photo shop and goto &quot;image|adjustments|levels&#8230;&quot; you&#39;ll see something that looks like this: <img loading=\"lazy\" decoding=\"async\" alt=\"\" class=\"alignleft size-full wp-image-9\" height=\"301\" src=\"http:\/\/rodgreen.com\/wp-content\/uploads\/2008\/04\/rgbnormal.png\" title=\"RGB Normal Curve\" width=\"405\" \/> This is a combined view of all three channels. Under each channel you can see the positive and negative values as mentioned above: <img loading=\"lazy\" decoding=\"async\" alt=\"\" class=\"alignnone size-full wp-image-7\" height=\"301\" src=\"http:\/\/rodgreen.com\/wp-content\/uploads\/2008\/04\/rednormal.png\" title=\"Red Normal Curve\" width=\"405\" \/> <img loading=\"lazy\" decoding=\"async\" alt=\"\" class=\"alignleft size-full wp-image-6\" height=\"301\" src=\"http:\/\/rodgreen.com\/wp-content\/uploads\/2008\/04\/greennormal.png\" title=\"Green Normal Curve\" width=\"405\" \/> So from left to middle represents the quantity of negative values on X &amp; Y (Red &amp; Green respectively) contained in the image. From middle to right represents the quantity of postive values on X &amp; Y contained in the image. Normal X -1 = Red Channel 0 Normal X 0 = Red Channel 127 Normal X 1 = Red Channel 255 Normal Y -1 = Green Channel 0 Normal Y 0 = Green Channel 127 Normal Y 1 = Green Channel 255 <img loading=\"lazy\" decoding=\"async\" alt=\"\" class=\"alignleft size-full wp-image-8\" height=\"301\" src=\"http:\/\/rodgreen.com\/wp-content\/uploads\/2008\/04\/bluenormal.png\" title=\"Blue Normal Curve\" width=\"405\" \/> However the blue channel left to right represents the quantity of positive values on Z contained in the image. Normal Z -1 = Not represented Normal Z 0 = Blue Channel 0 Normal Z 1 = Blue Channel 255 Since the default Z (or blue) value for a normal is 1 (or 255) this channel can only subtract from this value therefore it cannot make the Z value greater then 1.<\/p><\/blockquote>\n<p>What does this all mean?<\/p>\n<blockquote><p>Basically since we are representing normal data using an image format and that not all three channels are storing data in the same way we need to make sure we handle <strong>each channel<\/strong> to take this into account. Most importantly though this also identifies that each channel contains both <strong>negative and positive values represented in a positive range<\/strong>. Which means any technique that just Adds, Subtracts or Multiplies will result in incorrect results. Default Normal = (X 0, Y 0, Z 1) = (R 127, G 127, B 255) This default normal is the base normal for the polygon so any texel with the RGB normal value of 127,127,255 will use the polygons normal.<\/p><\/blockquote>\n<p>Part I &#8211; Break image into positive and negative values:<\/p>\n<blockquote><p><em>Note:<\/em><\/p>\n<blockquote><p><em>Positive Values:<\/em><\/p>\n<blockquote><p><em>Red 128 -&gt; 255<\/em> <em>Green 128 -&gt; 255<\/em> <em>Blue NA<\/em><\/p><\/blockquote>\n<p>\t\t<em>Negative Values:<\/em><\/p>\n<blockquote><p><em>Red 0 -&gt; 128 <\/em> <em>Green 0 -&gt; 128 <\/em> <em>Blue <\/em><em>0 -&gt; 255<\/em><\/p><\/blockquote>\n<\/blockquote>\n<ol>\n<li>Duplicate Normal Map A and rename it to &quot;NormalMapA_Add&quot;<\/li>\n<li>Rename Normal Map A to &quot;NormalMapA_Subtract&quot;<\/li>\n<\/ol>\n<\/blockquote>\n<blockquote>\n<blockquote><p>Remove negative values from &quot;NormalMapA_Add&quot;<\/p>\n<ol>\n<li>Select &quot;NormalMapA_Add&quot; layer<\/li>\n<li>Goto &quot;Image|Adjustments|Levels&#8230;&quot;<\/li>\n<li>Set the Red Input channels to &#39;128&#39; &#39;1.00&#39; &#39;255&#39;<\/li>\n<li>Set the Red Output Levels to &#39;128&#39; &#39;255&#39;<\/li>\n<li>Set the Green Input Channels to &#39;128&#39; &#39;1.00&#39; &#39;255&#39;<\/li>\n<li>Set the Green Output Levels to &#39;128&#39; &#39;255&#39;<\/li>\n<li>Set the Blue Output Levels to &#39;0&#39; &#39;0&#39; (this mutes the blue channel)<\/li>\n<\/ol>\n<\/blockquote>\n<blockquote><p>Remove positive values from &quot;NormalMapA_Subtract&quot;<\/p>\n<ol>\n<li>Select &quot;NormalMapA_Subtact&quot; layer<\/li>\n<li>Goto &quot;Image|Adjustments|Levels&#8230;&quot;<\/li>\n<li>Set the Red Input channels to &#39;0&#39; &#39;1.00&#39; &#39;127&#39;<\/li>\n<li>Set the Red Output Levels to &#39;0&#39; &#39;127&#39;<\/li>\n<li>Set the Green Input Channels to &#39;0&#39; &#39;1.00&#39; &#39;127&#39;<\/li>\n<li>Set the Green Output Levels to &#39;0&#39; &#39;127&#39;<\/li>\n<\/ol>\n<p>\t\tNB: Don&#39;t make any changes to the Blue channel.<\/p><\/blockquote>\n<\/blockquote>\n<p>Part II &#8211; Convert layers to value offsets :<\/p>\n<blockquote><p><em>Note:<\/em> In order to get the offset for both the add and subtract layers we need to find out how much they deviate from the default value. As stated above the default normal vector is &lt;0, 0, 1&gt; .<\/p>\n<blockquote><p><em>Default Vector Value:<\/em><\/p>\n<blockquote><p><em>X 0 = R 127<\/em> <em>Y 0 = G 127<\/em> <em>Z 1 = B 255<\/em><\/p><\/blockquote>\n<\/blockquote>\n<p>\tTherefore we need to add this to the subtract layer and subtract it from the add layer to get the offset for each. To do this we can use a photoshop process called &#39;channel mixer&#39;. Convert &quot;NormalMapA_Subtract&quot; to offset values<\/p>\n<ol>\n<li>Select &quot;NormalMapA_Subtact&quot; layer<\/li>\n<li>Goto &quot;Image|Adjustments|Channel Mixer&#8230;&quot;<\/li>\n<li>In &#39;Output Channel Red&#39; Set the\n<ul>\n<li>Red to -100%<\/li>\n<li>Green to 0%<\/li>\n<li>Blue to 0%<\/li>\n<\/ul>\n<\/li>\n<li>Set the constant to +50%<\/li>\n<li>In &#39;Output Channel Green&#39; Set the\n<ul>\n<li>Red to 0%<\/li>\n<li>Green to -100%<\/li>\n<li>Blue to 0%<\/li>\n<\/ul>\n<\/li>\n<li>Set the constant to +50%<\/li>\n<li>In &#39;Output Channel Blue&#39; Set the\n<ul>\n<li>Red to 0%<\/li>\n<li>Green to 0%<\/li>\n<li>Blue to -100%<\/li>\n<\/ul>\n<\/li>\n<li>Set the constant to 100%<\/li>\n<\/ol>\n<p>\tConvert &quot;NormalMapA_Add&quot; to offset values<\/p>\n<ol>\n<li>Select &quot;NormalMapA_Add&quot; layer<\/li>\n<li>Goto &quot;Image|Adjustments|Channel Mixer&#8230;&quot;<\/li>\n<li>In &#39;Output Channel Red&#39; Set the\n<ul>\n<li>Red to +100%<\/li>\n<li>Green to 0%<\/li>\n<li>Blue to 0%<\/li>\n<\/ul>\n<\/li>\n<li>Set the constant to -50%<\/li>\n<li>In &#39;Output Channel Green&#39; Set the\n<ul>\n<li>Red to 0%<\/li>\n<li>Green to +100%<\/li>\n<li>Blue to 0%<\/li>\n<\/ul>\n<\/li>\n<li>Set the constant to -50%<\/li>\n<li>In &#39;Output Channel Blue&#39; Set the\n<ul>\n<li>Red to 0%<\/li>\n<li>Green to 0%<\/li>\n<li>Blue to +100%<\/li>\n<\/ul>\n<\/li>\n<li>Set the constant to 0%<\/li>\n<\/ol>\n<\/blockquote>\n<p>Part III &#8211; Set the layer blend types :<\/p>\n<blockquote>\n<ol>\n<li>Select &quot;NormalMapA_Add&quot; layer<\/li>\n<li>Set the layers blend mode to &#39;Linear Dodge&#39;<\/li>\n<li>Select &quot;NormalMapA_Subtact&quot; layer<\/li>\n<li>Set the layers blend mode to &#39;Difference&#39;<\/li>\n<\/ol>\n<\/blockquote>\n<p>And thats it! You can either flatten the layers or leave them as blend layers. I typically add the two layers into their own folder (group) which I can then flatten when needed. <strong>You can download this whole process as an action <a href=\"https:\/\/www.rodgreen.com\/downloads\/OffsetActions.atn\" title=\"Download The Actions\">here<\/a>.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial will outline the best way I&#39;ve found to &#39;add&#39; two normal maps in photoshop. This method specifically adds two normal maps it doesn&#39;t average, subtract or multiply.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-217","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/posts\/217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=217"}],"version-history":[{"count":0,"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=\/wp\/v2\/posts\/217\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rodgreen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}