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.
#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.outAlpha, d=True ) myBump.bumpDepth >> myNormal.colorGainR myBump.bumpDepth >> myNormal.colorGainG myBump.bumpDepth >> myNormal.colorGainB expression(ae=False, n=myNormal + '_normalMapExpression' ,o=myNormal, s='colorOffsetR = (1 - colorGainR) * 0.5; \ncolorOffsetG = (1 - colorGainG) * 0.5; \ncolorOffsetB = (1 - colorGainB) * 1.0;' ) normalStrength()
10 Replies to “modify normal map intensity in maya”
You are not entirely clear how to use it. Do you select your bump2d node and execute it? It returns
# Error: line 1: AttributeError: file c:\binded_pkg\maya\2014.0\platform-windows\arch-AMD64\ext\Python\lib\site-packages\pymel\core\nodetypes.py line 332: nt.Bump2d(u’bump2d1′) has no attribute or method named ‘outAlpha’
I’d like some clarification on this :)
You need to select the file node (that is connected to your bump2d). I edited the script above to make that more clear. Thank you for pointing this out. Let me know if it works for you then! :)
Hello ! i am not a pro in Maya and when i run the script (after select my file node of course) maya told me :
# Error: NameError: file line 2: global name ‘ls’ is not defined #
Any Suggestion please ? :s
Make sure to run
from pymel.core import *
at first! Pymel is a special python flavour in maya and you need to import it everytime you launch a new maya session.
Hello Stefan ! Sorry, didn’t see your response ! BUUUT, it’s work PERFECTLY now !
Thanks x1000 ! :o
Awesome :) Great to hear!
You my friend are an absolute master! Thank you for this script :)
Thank you from Russia. Very useful script
Hey thanks for this! it connects up all fine but it seems to just make the result appear black. Any ideas why this is?
Im getting the same.