Table of Contents

This page includes details on the Switch utility material in V-Ray.


VRaySwitchMtl can be used to switch between different materials based on a value sampled from a texture.

To learn more on how to use VRaySwitchMtl, check the Using Custom Attributes to Match Proxy and Material tutorial.




Switch – The texture which is sampled to switch between the assigned materials.

No Map – Assigns a texture map to the Switch material.

Material 1 - Material 10 – Materials to be used based on the value of the the switch texture.

Material 0 is assigned for values 0 - 0.499
Material 1 is assigned for values 0.5 - 1.499
Material 2 is assigned for values 1.5 - 2.499
Material 3 is assigned for values 2.5 - 3.499
Material 4 is assigned for values 3.5 - 4.499
Material 5 is assigned for values 4.5 - 5.499
Material 6 is assigned for values 5.5 - 6.499
Material 7 is assigned for values 6.5 - 7.499
Material 8 is assigned for values 7.5 - 8.499
Material 9 is assigned for values 8.5 and larger.

Values are defined by the assigned Switch map, or the Switch field when no map is specified. When no material is linked to the current value, the geometry doesn't have a valid shading so it won't be visible in the render.

The VRaySwitchMtl doesn't have a default material. If the switch value points to an empty (undefined) material slot the result shading will use the first valid material (the one with the lowest switch value) specified in the VRaySwitchMtl.




Example: VRaySwitchMtl with VRayUserScalar


This simple example uses VRayUserScalar to control how materials from a VRaySwtichMtl are distributed to different objects.

Two different VRayFastSSS2 materials are linked as Material 1 and Material 2 in a VRaySwtichMtl material. A VRayUserScalar is used as the SwitchMtl's Switch map and a user attribute named ball drives the material distribution.



The same VRaySwitchMtl is assigned to two spheres and the VRayUserScalar texture determines how Material 1 and 2 are distributed between the spheres.



User attribute for the first object


User attribute for the second object





The left sphere receives Material 1 and the right sphere receives Material 2




Example: VRaySwitch for Animation


This example shows how VRaySwitchMtl can be used to change an animated object's material at different time frames. 

Two different materials – an aluminium VRayMtl and a self-illuminated VRayLightMtl – are linked as Material 1 and Material 2 in a VRaySwtichMtl material to simulate day and night time. The VRaySwitchMtl receives different switch value for frame 1 and frame 2 of the animation.

To simulate daylight better, color correction layers are used. For the night time, additional lights are added and Lens Effects layer is enabled.







Switch value in the initial frame


Switch value in the next frame









Was this helpful?