TUTO: Use RandomColorTexture node with non instance meshes
Posted: Wed Apr 12, 2017 2:40 pm
The randomColor node is one of the most important Octane node and works out-of-the box with maya instancers (particles or Mash)
currently it doesn't work with regular Maya Instance because of a very old bug in the plugin,
but it can work with regular meshes (no instance)
Basicaly you only have to change the
(setting Bake ID to 1 is to workaround another bug in the plugin, it's a way to force the plugin to export the RandomSeed value)
Here is an example scene, the spheres are different objects (no instance) using the same material
As it can be tedious to setup lot of meshes, I made this little python script for that:
Just select the meshes (or the top hierachy) that you want to use randomColor node with and execute this python script in a python tab.
currently it doesn't work with regular Maya Instance because of a very old bug in the plugin,
but it can work with regular meshes (no instance)
Basicaly you only have to change the
Bake ID
to 1 and set a different RandomSeed
for each mesh, then randomColor node will work (setting Bake ID to 1 is to workaround another bug in the plugin, it's a way to force the plugin to export the RandomSeed value)
Here is an example scene, the spheres are different objects (no instance) using the same material
As it can be tedious to setup lot of meshes, I made this little python script for that:
- Code: Select all
# For all meshes found in the selected hierarchies this script set octBakGr to 1 and set randColorSeed to a number based on selection order.
# This is useful to make the random color node works with non-instance meshes.
import maya.cmds as cmd
meshes = cmd.listRelatives(cmd.ls(sl= True, visible=True) , path=True, type="mesh", allDescendents=True, ni=True)
if meshes:
i = 0
for mesh in meshes:
cmd.setAttr( mesh+".octBakGrId", 1 )
cmd.setAttr( mesh+".octRandomSeed", i)
i=i+1
Just select the meshes (or the top hierachy) that you want to use randomColor node with and execute this python script in a python tab.