randomise sub-material by render/instance ID?

I’m looking for something that works like multisubtex for randomisation but at a shader level. The situation is I have a multisubmaterial on a load of different objects. For one of the sunmaterials I want to randomise it in to different materials.

Is there something I can plug in to VraySwitchMtl that will pick up the individual scene IDs of instanced geomety (some of which are proxies)

I could probably write some kind of script to do it with user info if I knew how, however I will need to be using those for another map selection that needs to be precise. The selection of this particular set of materials I would like to be random.

Ideally this would be done at a shader level, rather than a map level as it’ll make the process easier to manage, rather than matching up maps across a range of slots.

Alternatively, if I do have to use multiple VrayMultiSubTex, and give them the same random seed, would they select the respective maps between instances?

One thing that I thought of is using a VRayUserScalar node for the Switch value and using this little script I wrote to assign a random value to a user property.

EDIT: Updated script, since it was overriding existing User Properties. Fixed it.
random user prop.7z (740 Bytes)

Sounds amazing! That will definitely be useful in future. For this case I ended up setting it up with maps, I’ll keep that script for future