How to apply user created attributes in a V-ray shading network inside Houdini

In this tutorial I will show you how to use an attribute created in SOPS inside a V-ray shading network.

In this practical example, I have a 3D model of a woman and I will create a mask to control the blending factor between a metal material and a dirt material. The dirt material will be applied to the white part of the mask. The black part will hold the metal material. I used the measure SOP to create the curvature attribute.


The woman.
The woman.

The measure SOP used to create a procedural curvature texture.
The measure SOP used to create a procedural curvature texture.

Inside the material network matnet1, I created a V-ray Material Builder to adjust the mask. V-ray for Houdini offers four user data nodes to retrieve information from user created attributes. In this example I used the V-ray user float node because the mask is a scalar information and color is not needed.


V-ray for Houdini has four user data nodes available.
V-ray for Houdini has four user data nodes available.

Then, two colors nodes, one with a black and the other with a white value was created...


A color node with 0 (black) as value.
A color node with 0 (black) as value.

A color node with 1 (white) as value.
A color node with 1 (white) as value.

...and connected to a V-ray TexBlend node. This node is connected to the diffuse slot in a V-ray material shader to allow us to see and adjust the mask using the IPR.


The V-ray TexBlend node is used to mix two colors or textures.
The V-ray TexBlend node is used to mix two colors or textures.

In the V-ray userFloat node it is necessary to write the name of the attribute we want to read the information from. In this case, curvature.


The name of the user created attribute should be written in the Attribute textbox.
The name of the user created attribute should be written in the Attribute textbox.

The remap node was used to fine tune the strength of the curvature mask.


The remap node was set to value because it is modulating a scalar data.
The remap node was set to value because it is modulating a scalar data.

Then, we have the result in the IPR window:


The IPR give us the feedback of how strength the mask is.
The IPR give us the feedback of how strength the mask is.

After we have the mask ready, we have to use a V-ray Blend Material node to mix the metal and the dirt material. I created another V-ray material builder and put the metal and dirt material network there (I used the weathered metal and the soil material from the V-ray material Library). Then, I copied and pasted the mask network into there. The weathered metal material was connected to brdf_1, and the soil material was connected to brdf_2. The mask network was connected to weight_2 to do the blending correctly. In this example, if the mask network were connected to weight_1, the blend result would be inverted.


The V-ray BRDF Layered node allows to stack materials.
The V-ray BRDF Layered node allows to stack materials.

Then, we check the result in IPR and do the final render.


The result of the material blending driven by an user created attribute.
The result of the material blending driven by an user created attribute.

And do not forget: Donation = Loving




57 views0 comments