Use Component Swizzle to provide different vertex color channels to Stingray Physically Based Shader inputs

ShaderFX networks created with the Stingray PBS node use swizzling to allow individual components of xyz to take on the value of any of the xyz components.

In ShaderFX, RGB values are connected to XYZ by default. By default, X corresponds to R, Y to G, and Z to B. However, you can provide a float3 input of xxx or rrr - that is, the red channel is used for all of the 3 float values of float3. You can also provide rgg or xyy, where the red channel is used for the first float and the green is used for the second and third.

Create different shader effects by customizing the different channel inputs to the Standard Base node, such as base color and opacity.

Set Component Swizzle values

  1. In the ShaderFX editor for your Stingray PBS node, click the attribute that you want to adjust on the Standard Base node; for example, Base Color.

    Its Attribute Editor appears.

  2. In the Component Swizzle field, enter the channel that you want to input to this attribute.
  3. If the Component Swizzle field is empty, the default values are used (for example, rgb for xyz).

The following example demonstrates the different effects when the Base Color input is xyz (rgb) versus when the Base Color input is rrr.

Example: Connect your vertex color green channel to Ambient Occlusion

  1. Connect the RGBA output of your Color Map to the Base Color input of Standard Base.

    Your color map will provide the base color for your model.

  2. Connect the RGBA output of your vertex color to the Ambient Occlusion input of Standard Base.

    The float3 output is converted to float automatically and the r channel is used by default.

  3. Select the Ambient Occlusion channel in the Standard Base node, and in the Attribute Editor, enter g in the Component Swizzle attribute.

In this example, you can see the ambient occlusion on parts of the dinosaur's tail where it was painted green.

The r and b channels of vertex color can now be connected to other inputs; for example, r for Metallic and b for Roughness.

Related topics