Hi there,

here is a simple Xpresso setup to create a switch between two materials without reaffecting it to the texture tag manually. Especially useful when working with proxy texture (or low resolution videos) to switch back to the high resolution one at render time.

First, you need to create the User Data that will hold the boolean switch. Here, I placed it on a Null Object.

Then, add a Xpresso tag, and drag the texture tag of your object, as well as the Null Object containing the User Data.

Using a condition node, you’ll tell your boolean User Data to act as a switch between the 2 materials. Drag the two materials from the material manager, and link their “object” output to each input of the condition node.Set your condition node mode to “material”, otherwise it won’t link your “object” outputs.

That’s it. Enabling/disabling the switch will yield a 0 and 1 value, which will make either the red or green material to be affected to the texture tag.

Here is the file : switchc4d

4 thoughts on “How to create a switch between two materials?”

  1. Hi,
    thanks for your great xpresso switch. i´m just getting started with xpresso…is there a way to switch all texture tags with the same material applied (from different objects) simultaneously (more like a global switch), or do i have to drag every texture tag into xpresso and connect them to the condition output?
    Thanks a lot!
    Regards Micha

  2. Hi Micha, there’s unfortunately no way to make a switch between a bunch of materials and a single one (you’d have to tell Xpresso where each material goes back to when you switch back from your single material).

    For this, you would need to indeed either use a group of nodes as pictured above for each material, use scripting or a dedicated plugin.

    Otherwise, you can use the Object List Iteration node in Xpresso to control a series of objects, but it wouldn’t be useful in this case (because it wouldn’t know where each material needs to go to, with my example).

  3. Hi Matty, despite this blog entry being 10 years old, the technique still works fine (tested both in R17 and R19).
    The attached file still works, and recreating the Xpresso from scratch still uses the same nodes/method, as Xpresso hasn’t fundamentally changed since.
    Make sure you are either following my descriptions properly or that no plugin interferes with the setup.

Leave a Reply

Your email address will not be published. Required fields are marked *