Versions Compared

Key

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

...

Section
Column
width62%

The VRayUserColor texture can be used to read User-Defined object properties from the currently shaded node and convert them to a color value. This allows you to use the same shading network on several different objects in the scene, but to control various aspects of the material through User-Defined properties. This texture also has the ability to read mesh color sets, UV sets, and extra channel information from VRayProxy File Formats objects, as well as additional data channels from other plugins like Yeti.

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

 

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

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 color – Specifies the color 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

...

Example: User Properties

 

In the example below, user attributes are assigned to different objects with different values. A VRayUserColor 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 color parameter of the shader.

 

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

 

Image Added

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

 

Section
Column
width10%

 

Column
width35%

Image Added

User attribute for the first object

Column
width10%

 

Column
width35%

Image Added

User attribute for the second object

Column
width10%

 

 

Image Added

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

 

 

Example: Animated Custom Color Attribute

Section
Column
width55%

A VRayUserColor texture can control VRayMtl color parameters by a user attribute in an animation. A user attribute is assigned to an object with the help of scripting.

For this example, use MEL scripting to create a custom attribute of type float3, called myColor with a vrayUserColor_ prefix. The type float 3 means that this attribute holds 3 float values.

Code Block
addAttr -ln "vrayUserColor_myColor" -at float3 -keyable true -uac pSphere1;

Add three float attributes: one for each R, G and B color component. Make them children of the float3 attribute.

Code Block
addAttr -ln "vrayUserColor_myColorR" -at "float" -keyable true -p vrayUserColor_myColor pSphere1;
addAttr -ln "vrayUserColor_myColorG" -at "float" -keyable true -p vrayUserColor_myColor pSphere1;
addAttr -ln "vrayUserColor_myColorB" -at "float" -keyable true -p vrayUserColor_myColor pSphere1;
UI Text Box
typetip

This setup can be used on multiple objects sharing the same shader by simply modifying and re-using the script for other objects.

Column
width5%
 
Column
width40%

Image Added

 

 

...

Section
Column
width55%

The user attributes are accessible from object's Extra Attribute rollout or the Channel Box.

Make key frames and set different values of the user attribute for each key frame of the animation.

UI Text Box
typeinfo

Scripted custom color attributes cannot be textured.

Column
width5%
 
Column
width40%

Image Added

 

 

Section
Column
width55%

Assign a VRayMtl to the object. Link a VRayUserColor's оutColor to the VRayMtl Diffuse Color input.

Assign myColor as the User attribute name in VRayUserColor. Note that the vrayUserColor_ prefix is not needed here.

Column
width5%
 
Column
width40%

Image Added

 

 

Section
Column
width30%

Image Added

Frame 1

Column
width5%
 
Column
width30%

Image Added

Frame 2

Column
width5%
 
Column
width30%

Image Added

Frame 3

 

 

Example: Rendering Vertex Colors


Section
Column
width62%

The VRayUserColor texture can be used to render objects colored with vertex color painting.

Here is how it’s done:

  1. Create a VRayMtl and assign it to the object that has painted vertex colors.
  2. Create a VRayUserColor texture and link it to the Diffuse map slot of the VRayMtl.

Column
width5%
 
Column
width33%

Section
Column
width62%

3. Open . Get the name of the color set. The easiest way to do this is by opening the Color Set Editor from Mesh Display > Color Set Editor and select selecting the object in the viewport. This displays the available color sets in the Color Set Editor dialog.

Column
width5%

 

Column
width33%

Section
Column
width62%

4. In the Color Set Editor, Ctr+C copy the color set name by double clicking on it and then pressing Ctr+C.

Column
width5%

 

Column
width33%

...