- Properly define and register the custom light node.
- Define a light output procedure (optional).
- Define an illuminate procedure (optional).
- Register the custom node type & procedures.
Properly define and register the custom light node
The custom node type should be listed in the return value of the command listNodeTypes light
. This can be achieved by deriving the custom node class from MPXLocatorNode
and registering it with the light
classification.
User-defined light shapes can receive 3Delight Extension Attributes is desired. See this page for details.
Define a light output procedure (optional)
By default 3Delight for Maya will output a light shader call when outputting a light source shape. If the custom node type requires a different behaviour, a custom light output procedure should be defined:
global proc <lightOutputProcName> (string $light shape, string $shader collection)
The procedure can bear any name. It will be called with the following parameters:
Parameter | Description |
---|---|
string $light_shape | The name of the custom light shape to output. |
string $shader_collection | The name of the effective shader collection. |
Define an illuminate procedure (optional)
By default 3Delight for Maya will issue one illuminate
state per custom light node whenever an illuminate
statement is needed. If the custom node type requires a different behaviour (such as producing multiple illuminate
statements per light), a custom light illuminate procedure should be defined:
global proc int <lightIlluminateProcName> (string $shape name, int $state)
The procedure can bear any name. It will be called with the following parameters:
Parameter | Description |
---|---|
string $shape_name | The name of the shape to be rendered. This will be the shortest unique DAG path to the light shape. |
int $state | This value indicates if the light source should be turned on (non-zero value) or off (zero value). |
Register the custom node type & procedures.
To register the custom light node type, the following procedure must be defined:
global proc DL_userGetLightTypeData (string $node types[], string $requirements callbacks[], string $output commands[], string $illuminate commands[])
This procedure will register custom node types, their associated plugin requirements and procedures. The procedure is passed empty string arrays. For a given index, each array is expected to contain the relevant information for a given node type. The parameters are:
Parameter | Description |
---|---|
string $node_types[] | The names of the custom light node types. |
________________________________ | The name of procedures to be called before attempting to render nodes of the related type. If set to an empty string, of if the procedure evaluation returns a non-zero value, the related light node type is assumed to be a valid, renderable node type. |
string $output_commands[] | The names of the light output procedure matching the related custom node type. If set to an empty string, 3Delight for Maya will produce a light shader call when relevant. |
string $illuminate_commands[] | The names of the light illuminate procedure matching the related custom node type. If set to an empty string, 3Delight for Maya will produce a simple RiIlluminate statement when relevant. |