Share

Shader Data Type Conversions - Arnold User Guide

When shader parameters of are connected together, some allowance is made for parameters to be connected when they have different types. Here are the rules for automatic parameter conversions.

Key:

(empty) conversion is disallowed/ignored
copy copy (no need to convert)
expand all components set to the same source value
shallow copy for pointer types (pointer, node, array, matrix), copy the pointer, not the actual value
boolean cast zero means false, non-zero means true, and vice-versa
upcast smaller integer type just gets stuffed into a larger integer type
downcast larger integer type gets truncated into a smaller integer type
average the average of the components are taken

A few notes:

  • The node type (AI_TYPE_NODE) is currently resolved at scene creation time, and node-to-node shader connections are not formally allowed since they internally are turned into a connection based on the output type of the shader node. However, whenever one wants to pass a node along, they can pass it as a generic pointer type instead of using other mechanisms such as shader message passing. The vast majority of the time, if you are using pointer passing inside of your shaders, however, you should re-think your design.
  • No automatic conversions exist between integer types and floating-point types.
  • No automatic conversions exist between enumerations and any other type.

Was this information helpful?