It's possible to link shaders to some parameters in Arnold, for example, to assign a texture to the color of an Arnold Light or an Arnold Sky. C4DtoA has a custom UI widget for this feature, called shader link GUI.
The widget is a popup button where the user can select between the following modes:
- constant: displays an input field of the given parameter's type (e.g. color, float, etc.).
- texture: displays a C4D shader GUI where the user can set up a texture in a native way. Does not allow to assign a shader network.
- material: allows the user to assign an Arnold Material to the parameter which represents a network of shaders. Only texture type shaders are valid in this context.
The shader link custom GUI can be defined in a metadata (.mtd) file via the
linkable flag when the UI of an Arnold node is automatically generated. It's available only for integer, float, vector or color type parameters.
The shader link custom GUI can also be added manually in the resource file (.res).
The shader link GUI settings are stored in a BaseContainer under the id 998800. The container is a map of parameter ids (Int32) and shader link settings (BaseContainer). The following ids are available in the settings container:
- 101: type of the widget.
- 1: constant
- 2: texture
- 3: material
- 102: the constant value (e.g. the color vector)
- 103: the texture which is a BaseShader of type Xbitmap. The BaseShader object is inserted into the object which owns the parameter (e.g. Arnold Light, Arnold Sky), must be allocated and deallocated by the developer.
- 104: an Arnold Material (BaseMaterial) for the shader network mode.
The value (constant) also stored in the node data container at the parameter id.
Get the current settings
This example shows how to read the current value of the shader link GUI.
Edit the settings
This example shows how to set up the different types of shader link settings.
Assign Texture to Arnold Sky and Arnold quad light
This example creates an Arnold Sky and Arnold quad light object and assigns an image to the color parameter.
Download the complete example: shaderlink_test.zip