Is there any way to randomize vray proxies or the textures on vray proxies?
Lets say we have a hypothetical crowd scene. It’ll be a still frame so the characters in the scene don’t even need to move. Is there any way to import a row of a proxy and then say either:
A. Swap this proxy out for one of twenty random vrmeshs in a specific folder
or
B. Swap out the texture on the proxy for one of 20 random textures in the sourceimages folder.
Is this possible? And if not what alternative methods could you recommend to accomplish something similar?
Given that mesh_vraymesh is the name of the proxy node inside maya. $proxies[] stores the full paths you’ve listed for different proxies randomly be loaded.
Which would basically get a random entry from the list of proxies you have stored in $proxies[] and set it as a file name to the fileName2 of your VRayMesh node.
Maybe there’s a better solution for this, but it’s all I can think of at the moment.
For this you can use the Maya singleSwitch node. I’m attaching an example scene for this. Here’s the setup:
- there are 4 spheres in the scene, all of them with the same vrayMtl
- a ramp is connected to the diffuse of vrayMtl
- the ramp has two positions, each is mapped with a different texture
- interpolation is “none” and the ramp is a VRamp
- the singleSwitch.output is connected to ramp.vCoord
- this script:
int $inputs = `getAttr -size singleShadingSwitch1.input`;
for ($i=0; $i < $inputs; $i++)
setAttr ("singleShadingSwitch1.input[" + $i + "].inSingle") (rand(0,1));
adds a random number from 0 to 1 to each input in the single switch, which in turn samples a different position from the ramp and renders the texture found at that position.
or you can randomize user attributes to the mesh nodes, then use vrayUserScalar to read them and them pass this to the ramp.vCoord
or you can use a similar approach as for the proxy filenames, only with textures. singleSwitch1.zip (9.32 KB)