Please note that this documentation space offers information for V-Ray 3.6! For most up-to-date documentation, refer to V-Ray Next for Modo help.

This page provides information on the V-Ray Switch Material.


Page Contents



VRaySwitchMtl can be used to switch between different materials based on a value sampled from a texture. Using only one "Variation texture" with a linear gradient from 0 to 1, you can modify this gradient to increase/decrease the probability of choosing a particular material. With the VRaySwitchMtl material you can switch between materials of different types (standard V-Ray material, SSS, Car Paint, light material, etc.), but with the "Group Mask" effect you can blend only materials of the same type.

Compared to the other Schematic materials (V-Ray Blend Material and the V-Ray 2-Sided Material) the VRaySwitchMtl material allows multiple connections to its material slots, since the order doesn't matter (unless the user wants to modify the probability for choosing a material).




UI Path: |Shading viewport| > Shader Tree > Add Layer button > V-Ray Materials > V-Ray Switch Material




Input Value   – the texture which is sampled to switch between the assigned materials based on the value of the texture used.The Input Value channel takes a floating point value in the 0 to 1 range. The amount of connected materials will define the interval of values used to select the different materials. As an example if four materials were connected then the first material would be selected in the 0, 0.25 range, the second material in the 0.25, 0.5 range, the third material in the 0.5, 0.75 range and the fourth material by the 0.75, 1 range.

Another option would be to take the Texture Output of any texture which then returns the luminance range connected to the Input Value. Another example would be where a particle ID is used (as in Modo particle ID's always have a value of between 0 and 1 with the Variation Texture producing the actual particle ID's. As such this could be used to control the Input Value of the VRaySwitchMtl. But since the Variation Texture remaps these values using a curve, the curve must be input values unchanged.

Material(s) 0 - Material(s) 7 – materials to be used based on the value of the the switch texture.




Example: Using particle ID's as input values for the Input Values channel


A Particle generator driven Replicator using the V-Ray Switch material to give random Shaders to each particle at render time.

In this example a Replicator is using a particle generator as its Point Source While the Particle Generator itself is set to an Array Type with Count X, Y and Z values of 10, and Length X,Y and Z values of 10m as the basis. To save on time and length the supplied Modo Scene file already has the Particle Generator and Replicator set-up for you along with the materials to use in the V-Ray Switch Material that we'll set up during this example. These materials include V-Ray Materials, V-Ray Car Paint, V-Ray Light and V-ray Fast SSS2 materials. Also in the Modo Scene file is the Clear Coat and Blend material's that we'll be using later in this example.


  1. In your Shading Tab and add a Variation Texture by going to Add Layer >> Processing >> Variation Texture. Under its Properties change its Variation Type to Particle.
  2. In your Shading Tab add a VRaySwitchMtl to your scene by going to Add Layer >> V-Ray Materials >> V-Ray Switch Material.
  3. On the Variation Texture that you have just created Right Click and from the under the Effect column go to V-Ray Switch Material Channels >> vswitch Input value to set it to be the Input Value of the V-Ray Switch Material.
  4. The Variation Texture drives the material randomisation and this can be modified via its Value Gradient. While this gradient can be used to change how the materials are randomised, it must remain as a linear gradient between the 0,1 range. To do this click on the Edit Gradient button, this will open the Gradient Editor. Set the 0% control point to a value of zero, and the second point at 100% to 1.0. Select both points and set their curve type to Linear. (Examples of how a different Gradient Curve shape affects the material randomisation are shown after this example.)
  5. If you now click on the V-Ray Switch Material that you created and look in its properties next to the Input Value channel you will see a small blue cog with an white arrow. This means that the value is being driven externally. You can now add the V-Ray Materials you wish to use into Material 0 -7's channels. You will see at there are materials in the Scene already for you to connect to the VRaySwitchMtl.
  6. Add a V-Ray Blend Material by going to Add layer >>V-Ray Materials >>V-Ray Blend material. In your Schematic Tab connect your V-Ray Switch Material to the Base material channel of your V-Ray Blend Material.
  7. Connect the Clear Coat Material that is already in the Modo Scene, This is a V-ray material already set-up for our use in this example. Connect the Clear Coat Material to the Coat material 1 channel of your V-Ray Blend Material. As a result now the Clear Coat material will be applied across all materials in the V-Ray Switch Material.
  8. In the Schematic Tab, connect the BrickWall03_Bump.jpg to the Bump Value channel of the V-Ray Switch Material. This will mean that this bump will then work across all materials in the V-Ray Switch Material at render time.
  9. Your Schematic Tab should now look like the image below once you have completed this example
  10. If you now render your scene using the Render button in the Render V-ray Tab you will see the materials applied across all of the spheres (driven by our Particle Generator and the Replicator).


The Finished Schematic Layout




Examples: Gradient Curve values for the Value channel


Examples of Value Gradient Curve

By editing the Gradient curve that controls our Value Channel in the Gradient Editor, we can change how the randomization affects the material distribution. Below are a number of basic examples to illustrate this.


Linear Curve


A Linear Value Gradient in the 0,1 range


Resulting Material Distribution



S Curve


An S shape curve Value Gradient in the 0,1 range



Resulting Material Distribution



Custom Curve


A custom value Gradient Curve in the 0,1 range



Resulting material distribution



V-Ray Mtl Common

The V-Ray Mtl Common tab includes rollouts like Layer and Bump and Displacement, which include settings that are general among many V-Ray (and Modo) Materials. For more details, please see the Common V-Ray Material Attributes page.



  • Note that in this case shown above, that all the switched materials share the same bump map as well as the same clear coat layer.