Switchers For Randomizing Patterns
By Neil Blevins
Created On: Dec 10th 2013
Updated On: Feb 17th 2014

Lets say you have a bunch of rocks in a scene, and you want to give each rock a slightly different color to add variety. What you need is a switcher. What is a switcher? Basically, you define a set of patterns, and they get assigned to specific groups of objects, faces, etc, usually using some sort of ID value that connects the pattern to the thing its being applied to. So for example, you create a rock material that has 5 different rock colors, and then spread randomly the ID 1 to 5 on a bunch of rocks, and each rock receives one of the 5 rock colors.

Lets use 3dsmax as an example.

Using Multi-Map / MultiIDMap / VrayMultiSubTex

If you want to apply completely different materials to these objects, you'd use a material switcher like the sub-object Material. But since we only want to vary the color, and leave the rest of the material alone, what we need is a map switcher. Sadly, there's no one map switcher that works in all renderers. Here's the available map switchers...
For this tutorial, I'll use the VrayMultiSubTex, but the same basic technique works in all of the switchers, use whichever one works with your renderer of choice. For more information on which Switcher map to use and which ID type to choose, read my lesson on Switchers And IDs, Which To Use When. You also should download my Soulburn Script pack, as I'll be using the iDSetter Script.

So here's the basic process...

Lets say you have a bunch of seperate rock objects. First, select your rocks.

Run my iDSetter Script.

Set Low to 1 and High to 5. Hit Apply. Now inspect the rocks. Each rock has a Material modifier on it with a random Material ID from 1 to 5.

If you have instead of seperate objects a single object that contains multiple rock elements, then here's the trick for giving this object the appropriate Material IDs. Select your object, and assign a MaterialByElement modifier.This will assign a random Material ID per element (each rock).

Now that we've got the Material IDs assigned, lets assign a single rock map to the diffuse of the rock material...

Now put that rock bitmap map as a submap of VrayMultiSubTex. Set Num IDs to 5.

Now you can fill in the 5 slots with 5 completely different rock textures, or if you just want some color variation, put 5 ColorCorrection maps in the 5 slots, hook all 5 ColorCorrection maps to your original bitmap, and then tweak the color on each map slightly, making some darker, some lighter, some browner, etc.

And here's the result...

Now remember, since the rocks are all keyed off the Material IDs, if the directors says "I love it, but can you make that rock closest to camera one of the browner ones?" You can, just select that rock, and change the Material ID in the Material modifier to be one of the browner variations.

Using MultiTextureMap

Amir Naziri reminded me about CG Source's MultiTextureMap. This is another type of switcher that's available here: http://www.cg-source.com/multitexture.php It lets you take a bunch of maps, and randomly assign them to a set of objects using Material or Object ID. Or, you can load a single map, and play with the Random Color Adjustment to have each be a slightly different color / brightness / saturation. This plugin does have a few limitations though...
But it's certainly a useful plugin that may do exactly what you need in some instances, and is worth checking out.

Other Techniques

Urs Dubacher pointed out a few other scripts and plugins that can help with creating random variation:
Check em out if you want even more ways of achieving variation.


Remember, when you have a bunch of similar things, they're never all exactly the same, there's always subtle color variation and texture variation, even if they're all the same sort of rock, grass, wood planks on the kitchen floor, etc. The colors in the example above may be a little exaggerated to show the point, but even subtler variation can give a lot of life to your scene. So always use a switcher to give it a little variation.

This site is ©2014 by Neil Blevins, All rights are reserved.
Back to NeilBlevins.com