Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page provides information on the V-Ray User-defined Scalar Map.

 


Overview

...

Section
Column
width62%

The VRayUserScalar texture allows the user to read and return a single number value from the User-Defined properties of the currently shaded object as a result. This can be useful if the same material or texture is applied to several objects in the scene, but we want to control some of its aspects (i.e. material glossiness, or a blend between two other textures inside a Mix texture etc) with User-Defined properties.

The Example on the right uses a VRayUserScaler node to control the reflection glossiness value on a single V-Ray Material. The four different pieces of the shader ball have a VRayUserAttribute that dictates different values that drive the reflection glossiness.

 


UI Expand
titleUI Path: ||Hypershade|| > Create panel > VRay section > Utilities > VRay User Scalar

Image RemovedImage Added

 
Column
width5%


Column
width33%

 

 


Parameters

...

Section
Column
width62%

User attribute name – Specifies the name of the user attribute that is looked up and returned from this shading node.

Default value – Specifies the value to return if the user attribute is not found on the shaded object.

Required format for attribute name – Displays possible formats for the attribute in the V-Ray User Attributes string assigned to the object, and what is rendered as a result.

 
Column
width5%


Column
width33%



Examples

...

In the examples below, user attributes are assigned to different objects with different values. A VRayUserScalar texture reads the values and passes them to a shader at render time. This way we can pass different shader values that are controlled at the object level, allowing us to share the shader between all objects.

With the help of a user attribute we can control any scalar (float) parameter of the shader.

Note that alembics coming from other applications, e.g. Houdini, with custom attributes already baked in, can be read in the same way as the user attributes. See the Houdini to Maya Alembic Workflow tutorial for more information.

User attributes can be added though the Attributes > VRay > User attributes menu.

Example: User Properties


This example shows the format for the value of the user attribute and how it is interpreted. The VRayUserScalar texture controls the VRayMtl Reflection Glossiness parameter. A user attributed named reflectionGlossiness is used to specify different reflection glossiness values on two objects.


Section
Column
width25%


Column
width50%

Image Added

The same material is applied to both objects. A VRayUserScalar texture passes the values to the shader.

Column
width25%




Section
Column
width15%


Column
width30%

Image Added

User attribute for the first object

Column
width10%


Column
width30%

Image Added

User attribute for the second object

Column
width15%




Section
Column
width30%


Column
width40%

Image Added

Although the two objects have the same material, the glossiness is determined by the user property.

Column
width30%


Example: VRayUserScalar with VRaySwitchMtl


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

Two different VRayMtls are linked as Material 0 and Material 1 in a VRaySwtichMaterial. A VrayUserScalar is used as the SwitchMtl's Material Switch and a user attribute named outputMaterial drives the material distribution.


Section
Column
width25%


Column
width50%

Image Added

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

Column
width25%




Section
Column
width15%


Column
width30%

Image Added

User attribute for the first object

Column
width10%


Column
width30%

Image Added

User attribute for the second object

Column
width15%




Section
Column
width30%


Column
width40%

Image Added

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


Column
width30%