synopsis
The following shaders allow for conversions between data types:
- float_to_int
- float_to_matrix
- float_to_rgb
- float_to_rgba
- rgb_to_float
- rgb_to_vector
- rgba_to_float
- vector_to_rgb
The following table shows how data types are converted within Arnold itself. Key: boolean A few notes:Arnold Data Type Conversions
(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 TARGET SOURCE enum boolean byte int uint float RGB RGBA vector point point2 enum copy boolean copy boolean
castboolean
castboolean
cast byte
castcopy upcast upcast int boolean
castdowncast copy copy uint boolean
castdowncast copy copy float copy
r = flt
g = flt
b = fltr = flt
g = flt
b = flt
a = 1
x = flt
y = flt
z = flt
x = flt
y = flt
z = flt
x = flt
y = flt
RGB average(rgb)
copy
r = r
g = gb = b
a = 1
x = r
y = g
z = b
x = r
y = g
z = b
x = r
y = g
RGBA average(rgb)
r = r
g = gb = b
copy
x = r
y = g
z = b
x = r
y = g
z = b
x = r
y = g
vector vector.x
r = x
g = y
b = z
r = x
g = y
b = z
a = 1
copy
x = x
y = y
z = z
point pnt.x
r = x
g = y
b = z
r = x
g = y
b = z
a = 1
x = x
y = y
z = z
copy
point2 pnt2.x
r = x
g = y
b = 0
r = x
g = y
b = 0
a = 1
x = x
y = y
z = 0
x = x
y = y
z = 0
copy
string node pointer array matrix TARGET SOURCE string node pointer array matrix enum boolean byte int uint float RGB RGBA vector point point2 string copy node shallow copy pointer shallow copy array shallow copy matrix shallow copy