Variable

The 'Variable' object defines a 'local VSL channel'. A variable is visible everywhere within its parent level and in all the parent's sub levels. Variables can be used to store temporary results.

Variables have two attributes: name and type (float/vector/color).

The root level variables are different from other variables in that they are 'static'. This means that the storage for them is allocated once in the beginning of rendering and it does not change during successive evaluations of the material. This means that root level variables can be used to store constant data, which is initialized only once at the beginning of rendering (in a 'Material initialization' shader). Actually this also means that root level variables can pass data between shaders, but this capability should be used with care, because it may be difficult to ensure that the material is not evaluated again between writing to and reading from the variable. Ray tracing is a recursive process and the same material may be encountered again when following a reflected ray, etc. Therefore, user channels are a better alternative for this kind of purposes.