Use lights with ShaderFX

By default, the ShaderFX shader is bound to three lights.

Select the Material node in the ShaderFX editor. In the Maya Attribute Editor, the MaxNumberLights attribute allows you to adjust the number of lights that the shader is bound to.

In this scene are four lights of different colors. If you set MaxNumberLights to 4, all four lights contribute to the shader.

Note: Having a large number of lights assigned to your shader may slow down your shader performance, so you may want to keep it to a reasonable number.

You can also choose to bind only a subset of your lights to your ShaderFX shader so that only those lights contribute to your shader.

To bind a subset of your lights to your ShaderFX shader

  1. Select Hw Shader Nodes > Lighting > Light List to create a Light List node.
    Note: The square icon beside the Lights attribute indicates that it can accept more than one input.
  2. Select Hw Shader Nodes > Lighting > Light to create a Light node. Repeat for the number of lights that you want to bind.
  3. Select the Light node. In the Maya Attribute Editor, select the light that you want to bind to from the Lights drop-down list.
  4. Repeat Step 3 for each of your Light nodes.
  5. Connect each of your Light nodes to the Lights attribute of the Light List node.
  6. Connect the Number of Lights attribute of the Light List node to the Number of Lights attribute of the Material node.

In this example, only three of the four lights in the scene are bound to the shader: Red, Yellow and Blue. If you compare it to the image above, you can see that the green light is no longer contributing to the shader.