Ai User Data Float

Example 1

This short tutorial covers how to use the Ai User Data Float node to change the color value of two spheres.

  • Start off by creating an Ai User Data Float node and an Ai Standard Surface shader. Open the connection editor for both of them. Select the outValue of the Ai User Data Float node and connect it to the colorR attribute of the Ai Standard Surface shader.


  • Select the Ai User Data Float node and add a name in the Float Attr Name in the attribute editor. In this example, we have used the name 'Float'.

 

  • Create a sphere and add an attribute to it. When you add the extra attribute to the shape node, you must use the naming convention 'mtoa_constant_<attribute-name>'. In this example, you must use the name mtoa_constant_Float for the attribute. In the extra attributes for the sphere, you should see the new attribute 'Float' with a value of 1.

 

  • Duplicate the sphere and change the Float value for the second sphere to 0.3.

 

  • Render the scene. You should notice that the sphere on the left has the full red value of 1.0 as determined by our Float attribute of 1.0. Whereas the sphere on the right is a darker shade of red because we changed its Float attribute to 0.3.

 

Example 2

In this example, we will use an Ai UserData Float node to control the Offset of a 2d Texture Placement node.

  • Start off by creating an Ai Standard Surface shader and a 2d fractal texture. Connect the 2d fractal texture to the color attribute of the Ai Standard Surface shader.
  • Create four planes and assign the Ai Standard Surface shader to them. You should see that all of the planes have the same 2d texture placement.

 

  • Create an Ai User Data Float node. Under Float Attr Name type noiseOffset

 

  • Open the connection editor. Select the outValue of the Ai User Data Float node and connect it to the offsetU attribute of the 2d Texture Placement for the fractal texture.

Connect ouValue of Ai User Data Float to offsetU of 2d Texture Placement

 

The connections should look like this in the Node Editor Window:

 

  • Select one of the plane's (make sure you select its shape node) and add an attribute to it - Attributes>Add Attribute.
  • Under Long name type mtoa_constant_noiseOffset


  • Select the plane. In the Attribute Editor you should see the newly created attribute under Extra Attributes:

'MtoA Constant Noise Offset' attribute

 

  • Repeat the above steps for the above planes. However, change the Mtoa Constant Noise Offset value of each one. For example 0.2, 0.4, 0.6, 0.8.
  • Render the planes. You should see that the 'Offset U' attribute has shifted for each plane according to the value entered in the 'Mtoa Constant Noise Offset' attribute.

2d Texture Placement controlled by Mtoa Constant Noise Offset attribute

The scene can be downloaded here.

 

 

 

  • No labels