I have a particle system set up in Maya using instanced vray proxies to create a swarm of ants each carrying a different piece of a clock. The proxy system is working a treat and making render times a pleasure!
The guy who will be comping it has (rightly) requested random mattes for the instances so we can create a bit of variation in colour without having to set up multiple shaders/instances etc.
Any ideas how I could do this using the v-ray multimatte renderpass and particle ids?
I’m aware this is a bit of a general dynamics question but hope someone will have come across it in the past. Couldn’t find anything similar in the forum.
- Create the pp attr UserVector1PP or any other PP attr you’re not using.
- Create creation exp: particleShape1.userVector1PP = <<rand(0,1),rand(0,1),rand(0,1)>>; //assign random matte colors to particles
- Enable export of UserVector1PP from vrayexport attr
- Create particleSamplerInfo
- Create Ramp and delete all extra slots so you’re left with one color slot
- Connect particleSamplerInfo1.userVector1PP to ramp1.colorEntryList[0].color
- Create “extraTex” vrayrenderelement
- Connect ramp1.outColor vrayRE_Extra_Tex.vray_texture_extratex
This gives you the following:
or if you only want RGB mattes use the following exp:
float $rand = rand(0,1);
if ($rand > .66)
particleShape1.userVector1PP = <<1,0,0>>;
else if ($rand > .33)
particleShape1.userVector1PP = <<0,1,0>>;
else
particleShape1.userVector1PP = <<0,0,1>>;
Just to let you know, that system worked, but it didn’t seem to affect the instanced geometry, so I just duplicated the instances then added each of them to different object properties and multimatted those suckers.
Works well enough but would love to know how your script could be used to affect the instances, would save on set-up time, or did I miss something?