---
title: "VRaySwitchMtl"
canonical: "https://documentation.chaos.com/space/VMAX/113575824/VRaySwitchMtl"
format: markdown
---
This page includes details on the Switch utility material in V-Ray.

## **Overview**

---

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](https://docs-chaos.atlassian.net/wiki/spaces/VMAX/pages/113575519) tutorial.


<details>
<summary>UI Path</summary>

||Material Editor|| > **Material** > **Map Browser** > **Materials** > **V-Ray** > **VRaySwitchMtl**


![image](media://854db6ae-6322-4519-9f71-5f9f2db8d355)
</details>

![image](media://deabfd43-0168-4d2c-8d62-7544d24e0240)

## **Parameters**

---

**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.

![image](media://25dd061b-cd6b-4f42-a82d-0baf781f6e90)


---


### 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.



![image](media://e49451e1-40dc-4cc2-9255-11bede39c1de)

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


---


![image](media://43d6969a-492e-4b4a-a0e5-415c3169a6b9)


![image](media://843d70f1-87a7-426a-b908-59d14bb21c31)



![image](media://f2f97841-cc99-4641-9c9d-16cd0abf3423)




---


### 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.



![image](media://6a49f563-6674-43f6-b776-5caf5008486d)


---

![image](media://0a8f825d-101a-46eb-9bca-6b0c13f7fcf1)

Switch value in the initial frame

![image](media://36bb0b36-fc5d-47fc-b0b0-1bf6adce795b)

Switch value in the next frame


---


![image](media://24d4454b-4fcd-436f-b705-f323f997d648)


![image](media://7bb09e4c-fa2a-4998-bc8e-07985bd6861b)


## **Notes**

---

- VRaySwitchMtl is very powerful when used with the [VRayUserScalar ](https://docs-chaos.atlassian.net/wiki/spaces/VMAX/pages/113575347)texture to enable switching sub-materials to be applied based on object's user defined attributes. Check the [Using Custom Attributes to Match Proxy and Material](https://docs-chaos.atlassian.net/wiki/spaces/VMAX/pages/113575519) tutorial for further information.