sj_radio

sj_radio is a set of Arnold shaders that can be used to exchange data between different objects while rendering. With data, we mean one of the standard types: boolean, color, integer, scalar, vector. It all works like a radio: there is a broadcaster (sj_radio_station) than can send signals (of the listed types) on a given frequency, and several receivers (sj_radio_*) that can "listen" on that frequency.

Signals can be sent only top-down along the raytracing tree.
For instance a material shader can emit a color on a given frequency, that can be received from all the shaders (light, texture, materials) that will be evaluated because of the material's behavior.

sj_radio_station can send up to 10 signals for each of the standard types.
After sending the signals, the Color parameter is evaluated.

On the other end you can have the receivers (sj_radio_boolean, sj_radio_color, sj_radio_integer, sj_radio_scalar, sj_radio_vector).
Each of them has a default value, that is returned if the Frequency is off or if no signal was found for that Frequency.
Else, if a signal is detected for the selected Frequency, the associated value is returned.

Download

Get the shaders pack from here

Installation

The spdl and the dll/so files should be copied under the SItoA addon directory, or any other workgroup.
If using another workgroup, you will have to set the shaders search path to point to the dll/so directory in the rendering options. The spdl files must be copied under SItoA/Application/spdl (or under the Application/spdl directory of your workgroup).


Example

In this scene, there are two ground grids. The left side one emits green on Frequency 1, the right side one emits blue on the same Frequency.
The top grid is a plain standard reflector.
The red sphere has a ray switch shader, that evaluates sj_radio_color for reflected rays.
This shader listen on Frequency 1, so returns a different reflected color based on the objects (the ground grids) that fired the reflection rays after broadcasting the color value.