TUTO: Use RandomColorTexture node with non instance meshes

Sub forum for help and tutorials.

Moderator: JimStar

Post Reply
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

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 4080 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 435 times

As it can be tedious to setup lot of meshes, I made this little python script for that:
utilForRandomColor.zip
(474 Bytes) Downloaded 412 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.
Last edited by calus on Fri Apr 14, 2017 6:48 am, edited 1 time in total.
Pascal ANDRE
User avatar
aoktar
Octane Plugin Developer
Posts: 16063
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye
Contact:

Wow geniously. Thanks for idea
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
Post Reply

Return to “Help / Tutorials”