VRaySwitchMtl

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

UI Path: ||Material Editor window|| > Material/Map Browser > Materials > V-Ray > VRaySwitchMtl

images/download/attachments/60097768/Max2020_VRay5_Materials_UIpath.gif

images/download/attachments/60097768/Max2022_VRay5_VRaySwitchMtl_overview.jpg

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.

images/download/attachments/60097768/Max2020_VRay5_VRaySwitchMtl_parameters.png

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.

images/download/attachments/60097768/Max2023_VRay5_SwitchMtl_parameters.png

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

images/download/attachments/60097768/Max2023_VRay5_SwitchMtl_sphere1.png

User attribute for the first object

images/download/attachments/60097768/Max2023_VRay5_SwitchMtl_sphere2.png

User attribute for the second object

images/download/attachments/60097768/Max2023_VRay5_SwitchMtl_render.jpg

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.

images/download/attachments/60097768/Max2022_VRay5_VRaySwtichMtl_Lights_params.png

images/download/attachments/60097768/Max2022_VRay5_VRaySwtichMtl_fr1.png

Switch value in the initial frame

images/download/attachments/60097768/Max2022_VRay5_VRaySwtichMtl_fr2.png

Switch value in the next frame

daynight

images/download/attachments/60097768/Max2022_VRay5_VRaySwitchMtl_Frame01.jpg

images/download/attachments/60097768/Max2022_VRay5_VRaySwitchMtl_Frame02.jpg

Notes