Here’s a trick to impress your friends and family with. In this write-up I go about the why and the how, and then if you’
Last year, I had to work on a project where we were animating and rendering a bunch of different phones. They all had the same geometry and the only thing that changed between them were the colors and the materials. In some of the scenes we found ourselves constantly having to swap and replace blue phones with purple phones, then white phones, and then perhaps back to blue phones. As if this wasn’t tedious enough by itself, sometimes the lights were linked to the specific phone geometry and swapping them would break this completely.
Fortunately, there is this small fancy workaround that can make your life easier. Instead of having 4 different versions of the phone, or even swapping materials each time, there is a way to merge all of these different alternative materials into one Master material, and then swap between the different version with some User Data trickery.
The trick consists on creating User Data for your main null or object. In this User Data –Let’s name it “Variation”–, we are going to use the integer Quicktab Radio to assign values to different options, and then inside Redshift use the Integer User Data along with the ShaderSwitch to apply the different colors or materials. Let’s start with something simple like Ice cream colors.
On the User Data, we are going to write three options inside the QuickTab Radio. Option One (Red) will by default start with a 0, so Option Two (Yellow) is the number 1, and Option Three (Blue) is number 2:
0;Red
1;Yellow
2;Blue
Next, we are going to create a Redshift Material. Inside, we drop a ShaderSwitch node, which will allow us to choose between different colors (or materials!). In order to pick which color the ShaderSwitch will put through, we are going to use a RS Integer User Data, and in its field we will type the name of the User Data from our object, “Variation”.
What this will do is put through the value of whichever option we have selected.
As you can see now, changing the option in the object’s user data will send a different value to the ShaderSwitch, and therefore giving us our different version.
You can do this with colors like in our example, where the ouput will be wired into a material node. However, you can also plug materials into the ShaderSwitch, and then wire the ShaderSwitch directly to the output.
Furthermore, you can pair this up with Reference nodes to reference already created materials that you can plug into the ShaderSwitch. This way, you not only clean up the node tree a lot, but also whenever you want to change a material or make edits, you can go straight into the material instead of dealing with the “Master material” with the ShaderSwitch, which can become messy quickly.
Here’s another example using materials to drastically vary the look of the same object:
There are multiple ways of using Custom User Data to affect the ShaderSwitch. Instead of using User Data on the object, you could drop a redshift tag and use the Object ID instead, sending a 1,2,3 or any integer to the ShaderSwitch and thus varying the color. However, I find that this QuickTab Radio is the cleanest way and a lot easier to follow if you’re moving files around and sharing with others.
As a plus, this User Data can be keyframe animated, so you can simply switch between materials and colors any frame you like!
If you want to test this and play around for yourself, donwload the example here