TUTO: Use RandomColorTexture node with non instance meshes

Forums: TUTO: Use RandomColorTexture node with non instance meshes
Sub forum for help and tutorials.

Moderator: JimStar

TUTO: Use RandomColorTexture node with non instance meshes

Postby calus » Wed Apr 12, 2017 2:40 pm

calus 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 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 3218 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 365 times



As it can be tedious to setup lot of meshes, I made this little python script for that:
utilForRandomColor.zip
(474 Bytes) Downloaded 347 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
calus
Licensed Customer
Licensed Customer
 
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Re: TUTO: RandomColorTexture work with non instance meshes

Postby aoktar » Thu Apr 13, 2017 6:23 am

aoktar Thu Apr 13, 2017 6:23 am
Wow geniously. Thanks for idea
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
User avatar
aoktar
Octane Plugin Developer
Octane Plugin Developer
 
Posts: 15970
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye

Return to Help / Tutorials


Who is online

Users browsing this forum: No registered users and 1 guest

Sun Apr 28, 2024 8:43 am [ UTC ]