---
title: "VRayMultiSubTex"
canonical: "https://documentation.chaos.com/space/VMAYA/111740685/VRayMultiSubTex"
format: markdown
---
This page provides information on the V-Ray Multi Sub-Object Map.


## **Overview**

---

The VRayMultiSubTex texture distributes multiple textures to many objects via one single material based on specified IDs or a random distribution.

In the image shown here, the **Get ID from** parameter of a VRayMultiSubTex is set to **Object ID**. Each part of the ball has its own Object ID, and a different texture is assigned to each ID. The VRayMultiSubTex is then assigned to the **diffuse **channel of a single [VRayMtl](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111739405).


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

||Hypershade|| > **Create panel** > **VRay** section > **2D Texture** > **VRay Multi Sub Tex**


![image](media://21ebefc0-cfda-44ae-979c-1e4db05d14e4)
</details>

![image](media://74ff89ea-86d4-4a36-8870-930a4cf0a84d)

## **Parameters**

---

**Default Color** – Specifies a default color or texture for objects without Object IDs.

---

**Base parameters**

**Get ID from** – Specifies the meaning of the ID parameters. The dropdown menu offers the following three options:

**Random** – Randomizes based on the selected option below.  
**Use object ID** – The VRayMultiSubTex considers the Object IDs of the object when feeding the data (color or texture) to the material.  
**Texture Switch** – Enables the Switch texture parameter to determine which texture is used in the material.

When Get ID from is set to **Random**, the following checkbox options are active. You can select multiple options at once.** **

**By Object ID **–** **The VRayMultiSubTex assigns random colors based on the Object IDs of the objects.  
**By Render ID** – The VRayMultiSubTex assigns random colors based on RenderIDs (internally generated by V-Ray). Note that <span style="color: #172b4d">Render ID is inconsistent between renders. You can use the By scene name mode, instead. </span>  
**By Node name** – Generates a color index based on the name of the node that the texture is applied to.  
**By Instance ID** – The VRayMultiSubTex assigns random colors based on the IDs of objects instanced with the particle instancer in Maya.  
**By scene name** – The VRayMultiSubTex assigns random color/texture based on each object's full scene path. A full scene path means that it can be used for multiple objects with the same name but located on different levels/branches in the hierarchy of the scene, e.g. instances in different groups. This option preserves the same random result per object, even if one or more objects are added or deleted from the group.  
**By Poly Shell** – Randomizes color/texture per poly shell of an object.  
**By User ID** – Randomizes textures based on a **User Attribute **assigned to the specific objects and set in the User Attribute field of the VRayMultisubTex.

**User Attribute** – This field stores all user-defined attributes, separated by semi-colons, applied to the MultiSubTex.

**Switch texture** – A floating point value that calls the texture from the Texture List (below in the UI) by the ID number.

**Seed **– When the mode is set to **Random by node name**, this parameter allows the user to change the randomization pattern.

**Random Hue/Saturation/Gamma **– <span style="color: #272727">Active when the </span>**Get ID from**<span style="color: #272727"> parameter is set to some of the</span>** Random**<span style="color: #272727"> options. These parameters randomize the output color during post-processing. Each parameter's value specifies the maximum random deviation from the original value within a given scale. </span>*See the **[Random Hue/Sat/Gamma](#HSG)**** ****example*<span style="color: #172b4d">.</span>

<span style="color: #172b4d">**Hue **</span><span style="color: #172b4d">– Randomizes hue. The output color hue is modified within [-180°, 180°]. </span><span style="color: #172b4d">*See the *</span><span style="color: #172b4d">*[Hue Variation example](#HueRandomExmplanations)*</span><span style="color: #172b4d">*.*</span>  
<span style="color: #172b4d">**Saturation **</span><span style="color: #172b4d">– Randomizes saturation. The output color saturation varies within [-0.5, 0.5] offset. Values outside [0, 1] are clamped.</span><span style="color: #172b4d">* See the *</span><span style="color: #172b4d">*[Saturation Variation example](#HSGRandomExmplanations)*</span><span style="color: #172b4d">*.*</span>  
<span style="color: #172b4d">**Gamma **</span><span style="color: #172b4d">– Randomizes gamma. The output color gamma is gamma-corrected with random gamma (or 1/gamma) within [0..1].</span>

**Interpolate** – If the switch value falls between two textures from the **Texture list**, interpolates between them. Otherwise, when disabled, the closest texture from the list is used.

**Loop Through Textures **– This option works in **Use object ID** mode. When the faces or objects assigned with VRayMultiSubTex map are more than the sub-textures in the map, the **Loop Through Textures** option goes through all sub-textures and once they finish, reverts to the first sub-texture, continuing until all faces or objects get a sub-texture. In the Use object ID mode, all objects with an assigned ID different than 0 get a sub-texture. The ones with object ID equal to 0 get the **Default color**. 

---

**Texture List**

**Add New Item** – Adds a new sub-texture to the texture list.

**Used **– Reorders the connected textures according to their **Used checkbox **(** ** ). 

**ID/% **– When **Get ID from** is set to **Random**, this field displays **%** and specifies the probability each texture/color has of displaying compared to the rest. When **Get ID from** is set to **Use Object ID** or **Texture Switch**, this field displays the **ID** and specifies the ID for each texture/color.

**Tex** – Reorders the connected textures by name.

**Delete** – This column contains the delete buttons. Click on the   icon to delete the corresponding sub-texture.

**Texture UV Override** – This option applies a mapping source (such as [VRayUVWRandomizer](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/126049820)) to all the sub-textures. This way, all of the sub-textures can be 


![VMAYA_7.4.6_MultiSub_Params.jpg](media://f787cb74-90fe-468c-a2ba-67295dd78220)



## **How to Set up**

---

To set up the VRayMultiSubTex:

1. Connect VRayMultiSubTex to the material's desired input slot.
2. From the **Texture List** > **Add New Item** button, add the needed number of subtextures.
3. Connect the created textures to the VRayMultiSubTex subtexture slots, or create new subtextures from the checkered buttons in the **Texture List**.

![VMAYA_7.4.6_MultiSub_AddTexture.gif](media://a521d065-96c2-407d-86da-75853b0164a3)

> Macro (anchor)



---


### **Example: Hue Variation**

The following example shows how Hue Variation changes the scene.


![image](media://7b9d0718-0f67-4029-96d6-8d339c59a209)

 

![image](media://34e1cc0e-6a41-4e81-a4a2-23e540f3fb56)

![image](media://729914aa-c63e-43cf-a8ce-18b568c9be88)

> Macro (anchor)



---


### Example: Saturation Variation

The following example shows how Saturation Variation changes the scene.


![image](media://a0f0e254-6f30-4e28-89e5-f2ebad45e79c)

Saturation Variation set to 0.

![image](media://e3e766a6-17e0-4085-b3d2-984639680abf)

Saturation Variation set to 0.5. The Saturation is randomly modified within [-0.25 and +0.25] from the initial color of the spheres.

![image](media://b331add5-db0d-4352-9081-bf9b505a4db6)

Saturation Variation set to 1. The Saturation is randomly modified within [-0.5 and +0.5] from the initial color of the spheres.


---

### > Macro (anchor)

Example: **Random Hue/Sat/Gamma**

** **

The following example shows how the Random Gamma affects the objects in the scene. Each example uses the maximum value of 100.

![image](media://156ef037-3e3f-4316-89fe-9eb9f70210d2)


![image](media://51b3a135-c1ff-443a-b661-8ab8e6e50cfb)

![image](media://468e80a6-b60b-45af-abfc-654b8c72f0f8)

**Saturation **= 100.0

![image](media://07aed194-f4b3-43b6-a7bf-4d28b4352a82)

**Hue/Sat/Gamma**= 100.0


---


### Example: Loop Through Textures


The following example shows how the** Loop Through Textures** option affects the distribution of texture applied to five geometries with different IDs.

Here, we have a MultiSubTex map with four sub-textures whose interval of valid IDs is [1 - 4]. We also have five geometries whose IDs range from 1 to 6. The IDs of the first four geometries fall within the texture's interval. The fifth geometry's ID (6) is outside that interval. We also have a default color - red.

When the Loop Through Textures option is **disabled**, the geometries with valid IDs get a texture of equal ID number. The texture whose ID is 6 gets a default color.


![VMAYA_7.4.6_MultiSub_Params_Setup.jpg](media://9aff8935-4059-41c9-a1cc-80a7ab15120b)


![image](media://d57eb26a-57c2-4987-94ab-83418bc98825)

---

When the Loop Through Textures option is **enabled**, the geometry with ID = 6 is looped and gets the texture with ID = 2.


![VMAYA_7.4.6_MultiSub_Params_Setup_LoopThrough.jpg](media://95c5f4c3-8a8d-4baf-bb28-6a51ec806f9d)


![image](media://7b261c82-565f-4e66-84be-71d5274ccc72)

---

If we uncheck one of the textures, for example texture with ID = 2, V-Ray detects that there is no valid texture for the geometries with IDs = 2 and 6, and it assigns them a default color.


![VMAYA_7.4.6_MultiSub_Params_Setup_DisabledTexTwo.jpg](media://7b43e578-30e1-45cd-b1e5-03639e9fec60)


![image](media://e11a2484-5c75-4dc0-9ba4-5d65214ad658)


## **Common Uses**

---

A few typical uses for the MultiSubTex Map are as follow:

- Animated values for Switch texture
- User attributes passed with userScalar
- Expressions (most common is "= frame" to pass the current frame number as the switch driver)