## Normal map scale script

I was annoyed about the complexity to scale up a normal map value. So I created a script which adds a slider to the bump2d node.

# this script creates an attribute inside the bump2d node to scale normal map values # select all normal map file textures and run the script import pymel.core as pm normal_nodes = pm.ls(selection = True) for each_normal_node in normal_nodes: bump_node = pm.listConnections(each_normal_node, type = "bump2d") pm.addAttr(bump_node[0], ln = "normalmapScale", at = "float", dv = 0, min = 0, max = 10 ) for each_color in ["R", "G"]: pm.setDrivenKeyframe("%s.colorGain.colorGain%s" % (each_normal_node, each_color), cd = "%s.normalmapScale" % bump_node[0], dv = 0, v = 1, itt = "linear", ott = "linear") pm.setDrivenKeyframe("%s.colorGain.colorGain%s" % (each_normal_node, each_color), cd = "%s.normalmapScale" % bump_node[0], dv = 10, v = 11, itt = "linear", ott = "linear") pm.setDrivenKeyframe("%s.colorOffset.colorOffset%s" % (each_normal_node, each_color), cd = "%s.normalmapScale" % bump_node[0], dv = 0, v = 0, itt = "linear", ott = "linear") pm.setDrivenKeyframe("%s.colorOffset.colorOffset%s" % (each_normal_node, each_color), cd = "%s.normalmapScale" % bump_node[0], dv = 10, v = -5, itt = "linear", ott = "linear")

**Categorised as:** Uncategorized