Page 1 of 1

TUTO: Use RandomColorTexture node with non instance meshes

PostPosted: Wed Apr 12, 2017 2:40 pm
by calus
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 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)
IMG_12042017_154625_0.png
IMG_12042017_154625_0.png (6.51 KiB) Viewed 3266 times


Here is an example scene, the spheres are different objects (no instance) using the same material :)
IMG_12042017_161456_0.png

RandomColorNodeForNonInstance.zip
(62.31 KiB) Downloaded 371 times



As it can be tedious to setup lot of meshes, I made this little python script for that:
utilForRandomColor.zip
(474 Bytes) Downloaded 349 times

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.

Re: TUTO: RandomColorTexture work with non instance meshes

PostPosted: Thu Apr 13, 2017 6:23 am
by aoktar
Wow geniously. Thanks for idea