modify normal map intensity in maya

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;' )

8 thoughts on “modify normal map intensity in maya

  1. tehWever

    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\ line 332: nt.Bump2d(u’bump2d1′) has no attribute or method named ‘outAlpha’

    I’d like some clarification on this :)

  2. stefan

    Hey! :)
    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! :)

  3. Paul S

    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

    Paul S.

    1. stefan

      Hey Paul,

      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.

Leave a Reply to Paul S Cancel reply