I have never been a big fan of normal maps. It’s difficult to manipulate them, it’s hard to guess how they might influence your shading and – probably the worst part – it’s not possible to modify their strength in maya. This is why I avoided them most of the time in favour of bump maps even though normal maps can look a lot better.
Luckily, I found this thread where NextDesign posted a solution to enable normal map strength editing right inside of maya. It’s a bit tricky and it would be quite a pain, to wire everything together, everytime you want to use a normal map. This is why I decided to write a script for that. You just need to select your file node, run the script and you are ready to go. Now you can use the bump depth slider on your bump2d node to modify your normal map contribution – just as with your old school bump map. Isn’t that awesome?
It seems it is even possible to invert your normal map when you dial in negative values. And of course it works with every renderer that uses the standard maya bump2d & file node.
Happy shading!
#select your file node that is connected to your bump2d node and run the script from pymel.core import * def normalStrength(): myNormal = ls (sl=True) myBump=listConnections( myNormal[0].outAlpha, d=True ) myBump[0].bumpDepth >> myNormal[0].colorGainR myBump[0].bumpDepth >> myNormal[0].colorGainG myBump[0].bumpDepth >> myNormal[0].colorGainB expression(ae=False, n=myNormal[0] + '_normalMapExpression' ,o=myNormal[0], s='colorOffsetR = (1 - colorGainR) * 0.5; \ncolorOffsetG = (1 - colorGainG) * 0.5; \ncolorOffsetB = (1 - colorGainB) * 1.0;' ) normalStrength()
Leave a Reply