I wonder if there’s some way to change the color of the meshes with
variation based on the id or influence of another object or other
characteristic, but only with one material.
I notice this can be done easily with the colorJitter node in Arnold
although it is a random variation and It's good..
but there's a way to control the color more specifically?
I am testing some things in python and with the node editor in Maya but didn't find a way to do it.
Replies
Depending on how you create your objects.
Or you could use OSL to hack something together.
https://www.youtube.com/watch?v=vBZ0WaOl_B8
import pymel.core as pm
cube = cmds.polyCube()
color= 0.0
ran = 50
#Create Shader network
std = pm.shadingNode('standardSurface', asShader=1)
dataColor = pm.shadingNode("aiUserDataColor", asShader=1)
dataColor.attribute.set("colorSet1")
dataColor.outColor >> std.baseColor
#loop create cubes with vertex colors and assign shaders
for i in range(ran+1):
actualCube = cmds.duplicate(cube[0])
cmds.move(i*1.1,0,0, actualCube)
print(color/ran)
cmds.select(actualCube)
cmds.polyColorPerVertex( rgb=(1, (color/ran), (color/ran)), cdo =1)
cmds.setAttr(actualCube[0] + ".aiExportColors", 1)
color += 1
pm.hyperShade(assign=std)
cmds.delete(cube)