View Full Version : Combining Two Normal Maps In Maya?
07-31-2011, 09:23 AM
I have a problem and I'm wondering if I could get some help on my current problem.
Not trying to advertise my website but if you go to this tutorial I wrote about Combining two Normal Maps in Maya using the plusMinusAverage node(I know it's been written before but I thought I would do the tutorial anyway so people I know could find it easier.
So as you can see by the results it works, However it is actually softer than with a normal map which hasn't been averaged out.
Currently this is how I'm trying to fix it.
I have my two Normal maps plugged into a plugMinusAverage Node which is then plugged into a remapColor Node. The values for the remapColor on the Red and Green channel have a low value of -0.5 and a high range of 1.5.
I want to plug this into a bump2D node but it is a RGB so it won't plug into the bump node, I've tried a RGB to Luminace node then plugging that into the bump which works but it just turns into a Bump map no longer a normal map.
From what I figured looking at a normalmap file texture node plugged into a bump2d it uses the outAlpha with "Alpha is Lumiance".
So I tried plugging the file texture node into a RGB>Luminace into the Bump2D node which is set to tangent space and rendered. It is the same as just plugging the same normal map into the bump node set to Bump.
So what I'm asking is how can I change my RGB infomation into a single channel then plug it into the bump2d node but still be able to read the normal details?
Sorry for the long post
07-31-2011, 12:47 PM
It is kinda hard to understand your question.
RGB is 3 channels. The bump2d node in normal map mode, reads these 3 seperate channels. It is reading the luminance value from each channel seperately.
So as soon as you convert RGB to Luminance, you are baking it down to a single channel just like a bump map. You have lost all vector information needed in RGB, and it is essentially just R now.
What you need to do, is split each channel, do you color correction seperately, and then combine them into R, G, and B. Best way to do this, is pipe all outputs into a Ramp node, then map this to your bump node.
A while back I too tried to combine two normal maps in a similar way to how you did. In theory this should work. In practice, maya does not seem to be able to interpret the combined normal map correctly.
My take on this is as follows: When you hook up a single fileTexture to a bump2d node and check the connections in the hypergraph you see its using the outAlpha. For a simple bump map that makes sense, but not for a normal map where there are 3 colors involved. My guess is that when you set the bump2d to "Use as" tangent or object space normals, then maya simply takes the data it requires from the fileTexture that it finds connected to its normalCamera input and the actual connection is ignored. I found that if I connected anything between the fileTexture and the bump2d (eg plusMinusAverage or multiplyDivide etc) then it would not work as a normal map. Maya must be hard wired to only consider a single fileTexture connected directly. I guess this is what happens when they just quickly bolt some extra functionality onto an existing node, instead of writing a propper normal map node. :curious:
The only solution I have found (and it works really well) is to use the lyrid normal map plugin (http://www.creativecrash.com/maya/downloads/scripts-plugins/rendering/c/lyrid_normal_map--2) by Lv YueDong, who generously made the source code available. I think the 2010 version still works in the latest maya (though I have not tried it - so if it doesnt, let me know and I can recompile it).
edit: I just reread you blog post and noticed that you connected things differently to me. You might be onto something there. :thumbsup: My guess why it doesnt work exactly right is because you are adding some vector data that is not in world space - but I'm afraid vector math is not my strong point. It will be good if you can figure it out, but the plugin is still there if you cant.
07-31-2011, 11:19 PM
I found that maya needs a node with a proper RGB channels connected to the bump node.
So use the average node as intended, but connect it to a swatch of a ramp node then attach this to the bump node.
My suspicion is that the bump node in tangent space is looking at the alpha of each of the channels seperately.
07-31-2011, 11:42 PM
Here is an example scene file, with the shader setup:
Works in the viewport, and uses 3 different normal maps. Its not mathmatically correct, but should be good enough. The blend node will control the intensity of the normal map.
Requires Viewport 2.0 and I noticed that bump depth is now suported on normal maps.
The correct math requires R and G channels to be averaged, and B is multiplied. This would require a more complex shading network though, which I have also supplied. Its only one extra node, but the B channel is preserved.
David, you have such an amazing blog that i am constantly referancing to, please feel free to use that for your site if you wish.
08-01-2011, 12:07 AM
What you need to do is combine the two textures in a way that does not effect the detail contribution from each other. Average is going to do exactly what it says and average the details, not combine them together.
I haven't tried it in Maya, but in practice this composting method should work. Take the inverse of Map A, multiply the result by Map B, then Add the original Map A to that. This will effectively add differences in color/value changes that are not represented in both maps, combining them correctly together.
But I think you can combine them together the same way you chain bump maps (use the search on this forum). If that works, it will probably evaluate faster making it the better solution.
08-01-2011, 12:28 AM
I just tried that crispy, and Maya is not liking the results. I have a suspicion that it might have to do with normal maps using 8bit sRGB space and not linear math like a compositing app.
08-01-2011, 12:28 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.