---
title: "Maya Sampler Info Node with Additional V-Ray Outputs"
canonical: "https://documentation.chaos.com/space/VMAYA/111740031/Maya%20Sampler%20Info%20Node%20with%20Additional%20V-Ray%20Outputs"
format: markdown
---
This page gives provides examples on using the Sampler Info node with extra V-Ray Attributes.

 

## **Overview**

---

 

## **Additional Outputs**

---

## **Common Uses**

---

The SamplerInfo node extracts particular information about the scene. It then converts the gathered information into RGB data. It can be used within the Maya Hypershade or to drive a material channel to achieve various effects. This can provide more render passes with information that can allow more possibilities to editing during the compositing process.

 

---

 

### **Example: UV Coordinate Render Element**

 

By plugging in the SamplerInfo node to the [Extra Texture Render Element](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111739310), several additional render passes can be created.

To create a pass that represents UV coordinate information as red, green or blue colors, create a SamplerInfo node and use the Maya Connection Editor to connect the **U Coord** and **V Coord** outputs to different Vray Texture Extratex inputs for R, G, or B. In the example shown below, the **U Coord** output is connected to **Vray Texture Extratex R** and the **V Coord** output is connected to **Vray Texture Extratex G**. This causes the U coordinate information to appear as red in the render pass, while the V coordinate information appears as green.

 

 

 

---

 

> Macro (anchor)



### **Example: Random Colors by Object ID**

 

Using the SamplerInfo node with the V-Ray Additional outputs in Maya Hypershade, it is possible to apply a random color (or texture) over several objects based on each object's [Object ID](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111739463). To do this, connect the **Vray Random By ID** output to a ramp texture, and connect the ramp texture to any texture channel in a material. This applies a different color (or texture connected to a color slot in the ramp texture) for each ID on objects within a scene.

In the example rendering below, the switches, sliders, and buttons that appear in the bottom part of the image have been assigned various Object IDs, and objects with the same Object ID receive the same color.

 

![image](media://6fce03e4-389c-4b65-81b3-3f47f1c77510)

 

 

 

---

** **  
** **

** **> Macro (anchor)

** **  
** **

### **Example: Random Colors by Poly Shell**

 

The SamplerInfo node, with the V-Ray Additional outputs in the Maya Hypershade, makes it possible to apply a random color (or texture) to multiple objects that have been combined into a single object. This is done by connecting the **Vray Random By Poly Shell** output to a ramp texture which is then connected to any texture channel in a material. This applies a different color (or texture connected to a color slot in the ramp texture) to each poly shell within a scene.

In the example rendering below, the switches, sliders, and buttons in the bottom part of the image have been combined into a single object. As such, **Vray Random By Poly Shell** will apply a different color randomly to each poly shell within the object.

 

![image](media://d14c8316-bc9d-4e6b-af0f-4bdeed958014)

 

 

---

** **  
** **

### **Example: Control Shadows with Switch Material and Object IDs**

 

The Maya SamplerInfo node, with the V-Ray Additional outputs in the Hypershade, makes it possible to control which geometry casts shadows on other geometry within a scene. With this method, you control the casting and receiving of shadows via the [VRaySwitchMtl](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111740021) material and [Object IDs](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111739463) for the various objects.

For the object that is casting shadows on other objects:

- Assign the shadow-casting object an **Object ID** of *0*.
- In the material for this object, add [Material Attributes](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111742501) and choose **V-Ray Material Override** as the type. This makes the **Shadow Material** slot available for the material.
- Create a [VRaySwitchMtl](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111740021) material, and connect the** Materials Switch** attribute to the **Vray Parent Obj IDTex** output of a SamplerInfo node.
- Place this **VRaySwitchMtl** within the **Shadow Material** slot.

For objects that could potentially receive shadows from the shadow-casting object in the scene, assign an **Object ID** of *1* to geometry objects that you want to receive shadows, and an **Object ID** of *0* to geometry objects that you do not want to receive shadows. No special material is required for these objects.

In the example below, the V-Ray Switch material set up for shadow control is assigned to the topmost egg. By setting different Object IDs for other objects in the scene, shadows cast by the topmost egg can be limited to certain objects.

For more details, see the [Controlling Shadows Using the Sampler Info Node](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111740023) page for a step-by-step tutorial.

 

![image](media://018ea464-405a-41f8-a31f-f1ae7560bf4c)

 

 

 

---

 

### **Example: Random Colors with Switch Material**

 

The SamplerInfo node with the V-Ray Additional outputs, in Maya Hypershade, makes it possible to apply a random color (or texture) by connecting the **Vray Obj IDTex** output to the **Material Switch** channel on a [VRaySwitchMtl](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111740021).

 

![image](media://1e042473-628d-46c3-89ce-192ebb1c8d86)

 

 

---

> Macro (anchor)



### Example: Frame Index Offset 

 

With Maya SamplerInfo's extra attribute **Frame Index Offset** you can simulate a motion blur effect on a sequence of textures. In this example, we have a sphere object that changes its position with with each frame. <span style="color: #202124">The </span><span style="color: #202124">**Camera Motion Blur**</span><span style="color: #202124"> options are enabled with </span><span style="color: #202124">**Duration**</span><span style="color: #202124"> set to 2 frames. The object is initially assigned a material with an Image sequence file connected to its </span><span style="color: #202124">**Color**</span><span style="color: #202124">. This results in motion blurred geometry that only uses a single texture per frame.</span>

<span style="color: #202124">To achieve the mixing between the textures, a </span><span style="color: #202124">**VRayMultiSubTex**</span><span style="color: #202124"> with three sub-textures starting from 0 is created and linked to the </span><span style="color: #202124">**Color**</span><span style="color: #202124"> input instead. The three textures are connected to three file nodes within the same sequence, but a different </span><span style="color: #202124">**Frame Offset**</span><span style="color: #202124">: -1 for previous, 0 for current and 1 for next.</span>

<span style="color: #202124">The VRayMultiSubTex </span><span style="color: #202124">**Get ID**</span><span style="color: #202124"> </span><span style="color: #202124">**from**</span><span style="color: #202124"> is set to </span><span style="color: #202124">**Texture Switch**</span><span style="color: #202124"> and a </span><span style="color: #202124">**floatMath**</span><span style="color: #202124"> node is connected to control the </span><span style="color: #202124">**Switch texture**</span><span style="color: #202124">.</span> <span style="color: #202124">This is done because VRayMultiSubTex cannot have negative values for input. </span>

<span style="color: #202124">The SamplerInfo's extra attribute Frame Index Offset is plugged in </span><span style="color: #202124">**Float A**</span><span style="color: #202124">. </span><span style="color: #202124">**Float B**</span><span style="color: #202124"> is set to 1 with an </span><span style="color: #202124">**Add**</span><span style="color: #202124"> operation between the two. Now the 0 texture is used for the -1 or previous frame, 1 for the current or 0 frame and 2 for the +1 or next frame.</span>

 

 

![image](media://e3dc44b3-2fe6-4be7-87fb-8093f1c5db52)

Duration (frames) is set to 2 - the effect interpolates between the three frames using the three textures.

 

 

---

> Macro (anchor)



### Example: Translucency Level

 

 

The Translucency level output in the Additional Outputs of the samplerInfo node indicates the number of transparency intersections at a shaded point. In this example, we set up a VRaySwitchMtl with two semi-transparent materials: a reflective material at input 0 and a diffuse material at input 1. We use a floatLogic node to check the Transparency Level output and to return 0 (or false) when there are no more than 1 transparency intersections or 1 (true) when there are more than 1 intersections. The floatLogic then drives the VRaySwitchMtl so that the reflective material is assigned when we shade the first transparent object, but the diffuse material is used for the rest of the objects only when they are seen through the first transparent object. Download the scene to take a closer look at the setup.

 

> Macro (ui-button)