Bindings expressions reference¶
Here you can find the reference for the bindings expressions that you can add to the bindings of your nodes, render passes, material types, styles, and state managers. See Rendering, Material types and materials, Using styles and State manager.
Blue type marks the properties that are controlled by a binding.
When you create a binding for a property, the value that comes from that binding overrides the value that you set for that property in the Properties.
When creating bindings, keep in mind that:
Only bindings to similar data types are valid. For example, you can bind only color to color, vector2 to vector2, and so on. See Type casting.
Binding takes the value of the last expression, whether it is an assignment, unary or binary operation, or just a constant value or variable itself.
In bindings you can cast strings between the four fundamental types: integer, float, boolean, and string.
Casts between integer, float, and boolean are implicit and depend on the type of the property that uses the value. Casts to and from string are explicit.
See Using bindings and Troubleshooting bindings.
Syntax¶
# (comments)¶
Use a hash at the beginning of every line that contains a comment. You can use any sequence of characters in comments.
() (parentheses)¶
Use parentheses to group and contain expressions and parameters, and control the order of execution.
Operators¶
= (assign)¶
Assigns a value to a variable.
? (conditional)¶
The conditional operator takes three input parameters. If the first parameter (condition
) evaluates to true, the operator evaluates the second parameter (expression1
) and returns its value. If the first parameter evaluates to false, the operator evaluates the third parameter (expression2
) and returns its value.
Arithmetic operators¶
+ (addition)¶
Adds two or more values, or combines strings into one.
Syntax |
|
||||
Parameters |
|
||||
Returns |
the same type as parameters, except if one of parameters is float, it returns float |
||||
Examples |
- (subtraction)¶
Subtracts the value of the second parameter from the value of the first parameter. As a negation operator, it returns the result equivalent to multiplying the value by -1.
Syntax |
|
||||
Parameters |
|
||||
Returns |
the same type as parameters, except if one of parameters is float, it returns float |
||||
Examples |
* (multiplication)¶
Multiplies the values of parameters.
Syntax |
|
||||
Parameters |
Note When you use the multiplication operator, keep in mind that:
|
||||
Returns |
the same type as parameters, except:
|
||||
Examples |
/ (division)¶
Divides the value of the first parameter by the value of the second parameter.
Syntax |
|
||||
Parameters |
Note Only one of the parameters can be boolean, but not both. |
||||
Returns |
the same type as parameters, except:
|
||||
Examples |
Relational operators¶
== (equal)¶
Checks whether two values are equal.
!= (not equal)¶
Checks whether two values are not equal.
> (greater than)¶
Checks whether the value of the first parameter is larger than the value of the second parameter. For two strings checks whether the first string comes after the second string in alphabetical order.
< (less than)¶
Checks whether the value of the first parameter is smaller than the value of the second parameter. For two strings checks whether the first string comes before the second string in alphabetical order.
>= (greater than or equal to)¶
Checks whether the value of the first parameter is larger than or equal to the value of the second parameter.
<= (less than or equal to)¶
Checks whether the value of the first parameter is smaller than or equal to the value of the second parameter.
Logical operators¶
&& (logical AND)¶
Compares two expressions:
If both expressions evaluate to true, returns true.
If one or both expressions evaluate to false, returns false.
|| (logical OR)¶
Compares two expressions:
If one or both expressions evaluate to true, returns true.
If both expressions evaluate to false, returns false.
! (logical NOT)¶
Inverts the boolean value of an expression:
If expression evaluates to false, returns true.
If expression evaluates to true, returns, false.
Bitwise operators¶
~ (bitwise NOT)¶
Inverts the bits of the binary representation of an integer:
Bits that are 0 become 1.
Bits that are 1 become 0.
The bitwise NOT operation on integer x returns −(x+1).
The operation uses complementary binaries to represent negative integers. The first bit of the binary number is the sign bit:
If the first bit is 0, the number is positive.
If the first bit is 1, the number is negative.
& (bitwise AND)¶
Performs the logical AND operation on each pair of the corresponding bits of the binary representations of two integers:
If both bits are 1, the bit in the result binary representation is 1.
If one or both bits are 0, the bit in the result binary representation is 0.
X |
Y |
X & Y |
---|---|---|
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
The operation uses complementary binaries to represent negative integers. The first bit of the binary number is the sign bit:
If the first bit is 0, the number is positive.
If the first bit is 1, the number is negative.
| (bitwise OR)¶
Performs the logical OR operation on each pair of the corresponding bits of the binary representations of two integers:
If one or both bits are 1, the bit in the result binary representation is 1.
If both bits are 0, the bit in the result binary representation is 0.
X |
Y |
X | Y |
---|---|---|
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
The operation uses complementary binaries to represent negative integers. The first bit of the binary number is the sign bit:
If the first bit is 0, the number is positive.
If the first bit is 1, the number is negative.
^ (bitwise XOR)¶
Performs the logical exclusive or (XOR) operation on each pair of the corresponding bits of the binary representations of two integers:
If the bits are different, the bit in the result binary representation is 1.
If the bits are the same, the bit in the result binary representation is 0.
X |
Y |
X ^ Y |
---|---|---|
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
0 |
The operation uses complementary binaries to represent negative integers. The first bit of the binary number is the sign bit:
If the first bit is 0, the number is positive.
If the first bit is 1, the number is negative.
<< (bitwise left shift)¶
Performs a sign-extending shift of the binary representation of an integer to the left by a given number of bits.
Left shifting x by y bits:
Adds y rightmost 0 bits to the binary representation of x.
Removes the leftmost y bits in the binary representation of x.
This means that left shifting x by y bits multiplies x by 2 raised to the power of y:
The operation uses complementary binaries to represent negative integers. The first bit of the binary number is the sign bit:
If the first bit is 0, the number is positive.
If the first bit is 1, the number is negative.
>> (bitwise right shift)¶
Performs a sign-extending shift of the binary representation of an integer to the right by a given number of bits.
Right shifting x by y bits:
Removes the rightmost y bits in the binary representation of x.
Adds to the left y copies of the leftmost bit in the binary representation of x.
This means that right shifting x by y bits divides x by 2 raised to the power of y:
The operation rounds down the result.
The operation uses complementary binaries to represent negative integers. The first bit of the binary number is the sign bit:
If the first bit is 0, the number is positive.
If the first bit is 1, the number is negative.
Constants¶
Color4¶
Use the Color4()
constant to bind color property fields. Color4()
takes four parameters:
The first specifies the value for the red color channel
The second specifies the value for the green color channel
The third specifies the value for the blue color channel
The fourth specifies the value for the alpha channel.
Color values are mapped to the range 0..1.
See Color property bindings and Color functions.
Matrix3¶
Use the Matrix3()
constant to create a 3x3 matrix.
Syntax |
|
||
Parameters |
|
||
Returns |
Matrix 3x3 |
||
Examples |
Matrix4¶
Use the Matrix4()
constant to create a 4x4 matrix.
Syntax |
|
||
Parameters |
|
||
Returns |
Matrix 4x4 |
||
Examples |
Srt2D¶
Use the Srt2D()
constant to apply transformation to a 2D node with the Render Transformation or Layout Transformation properties. In the Binding Editor set the Property to Layout Transformation or Render Transformation.
You can extract a 2D transformation from a 3x3 matrix. See extractSRT2D.
Srt3D¶
Use the Srt3D()
constant to apply transformation to a 3D node with the Render Transformation or Layout Transformation properties. In the Binding Editor set the Property to Layout Transformation or Render Transformation.
You can extract a 3D transformation from a 4x4 matrix. See extractSRT3D.
Syntax |
|
||||||||||||||||||
Parameters |
|
||||||||||||||||||
Returns |
SRT Transformation 3D, calculated transformation for the scale, rotation, and translation of the bound 3D node |
||||||||||||||||||
Examples |
# Applies the transformation to the bound 3D node using the Layout Transformation
# or Render Transformation property, depending on which of these properties you
# set in the Binding Editor:
# - Scales the node to 70% on all axes
# - Rotates the node counter-clockwise 30 degrees on the x axis,
# 60 degrees on the y axis, and 30 degrees on the z axis
# - Translates the node by 2.5 device-independent units on all axes
Srt3D(0.7, 0.7, 0.7, -30.0, -60.0, -30.0, 2.5, 2.5, 2.5)
![]() |
Vector2¶
Use the Vector2()
constant to bind a vector property that has two property fields.
Syntax |
|
||||
Parameters |
|
||||
Returns |
Vector 2D |
||||
Examples |
Vector3¶
Use the Vector3()
constant to bind a vector property that has three property fields.
Syntax |
|
||||||
Parameters |
|
||||||
Returns |
Vector 3D |
||||||
Examples |
# In the Binding Editor set the Property to a property that uses the Vector 3D
# data type.
# For example, to set in the bound Point Light node the Point Light Attenuation
# property:
# - Constant property field to 1.2
# - Linear property field to 0.01
# - Quadratic property field to 0.02
Vector3(1.2, 0.01, 0.02)
|
Vector4¶
Use the Vector4()
constant to bind a vector property that has four property fields.
Syntax |
|
||||||||
Parameters |
|
||||||||
Returns |
Vector 4D |
||||||||
Examples |
# In the Binding Editor set the Property to a property that uses the Vector 4D
# data type.
# For example, to set in the bound Pipeline State Render Pass the Scissor Area
# property:
# - X to 0.2 to set the horizontal offset of the area to 20% of the width of the
# Viewport 2D
# - Y to 0.1 to set the vertical offset of the area to 10% of the height of the
# Viewport 2D
# - Width to 0.6 to make the area 60% of the width of the Viewport 2D
# - Height to 0.8 to make the area 80% of the height of the Viewport 2D
Vector4(0.2, 0.1, 0.6, 0.8)
|
Type casting¶
bool¶
Converts a value to a boolean.
Casts between integer, float, and boolean are implicit and depend on the type of the property that uses the value. Casts to and from string are explicit.
color4¶
Converts a value to a color. When converting from a float, sets the float value to the red, green, blue, and alpha channels of the color property.
See Color property bindings and Color functions.
Syntax |
|
||
Parameters |
|
||
Returns |
color |
||
Examples |
float¶
Converts a value to a float.
Casts between integer, float, and boolean are implicit and depend on the type of the property that uses the value. Casts to and from string are explicit.
Syntax |
|
||
Parameters |
|
||
Returns |
float |
||
Examples |
int¶
Converts a value to an integer.
Casts between integer, float, and boolean are implicit and depend on the type of the property that uses the value. Casts to and from string are explicit.
Syntax |
|
||
Parameters |
|
||
Returns |
integer |
||
Examples |
matrix3x3¶
Converts a 2D transformation to a 3x3 matrix.
matrix4x4¶
Converts a 3D transformation to a 4x4 matrix.
Syntax |
|
||
Parameters |
|
||
Returns |
Matrix 4x4 |
||
Examples |
string¶
Converts a value to a string.
Casts between integer, float, and boolean are implicit and depend on the type of the property that uses the value. Casts to and from string are explicit.
Syntax |
|
||
Parameters |
|
||
Returns |
string |
||
Examples |
vector2¶
Converts a float to a vector property that has two property fields. Sets the float value to both property fields of the vector property.
Syntax |
|
||
Parameters |
|
||
Returns |
Vector 2D |
||
Examples |
vector3¶
Converts a float to a vector property that has three property fields. Sets the float value to all property fields of the vector property.
Syntax |
|
||
Parameters |
|
||
Returns |
Vector 3D |
||
Examples |
vector4¶
Converts a value to a vector property that has four property fields. When converting from a float, sets the float value to all property fields of the vector property.
Syntax |
|
||
Parameters |
|
||
Returns |
Vector 4D |
||
Examples |
|
Functions¶
acquire¶
Gets a resource by looking up the resource ID that you pass to the acquire
function.
The resource ID must be in a resource dictionary of the node where you use the acquire
function, or one of its ancestor nodes:
If the resource is not yet loaded into application memory, the
acquire
function loads the resource.If the resource ID is not defined, the
acquire
function returns an empty value.
See Using resource dictionaries.
For example, you can create a binding that gets the resource ID of a text resource from a data source, loads the text resource, and sets a Text Block node to show the content of that text resource. If you localize that text resource, the Text Block automatically shows the value of the resource for the current locale of the application. If you change the data in your data source, the binding function gets the resource, to which the resource ID points, and updates the text.
See Using a binding to load resources.
Syntax |
|
||
Parameters |
|
||
Returns |
Resource |
||
Examples |
# Gets a text resource with a resource ID that you set in a custom property type
# MyCustomProperty whose data type is Text.
# For example, to show in a Text Block node the text to which the resource ID
# in MyCustomProperty points, bind the Text property of that Text Block node
# to this expression.
acquire({@./MyProject.MyCustomProperty})
# Gets a text resource with a resource ID that you set in a data object name
# whose data type is string.
# For example, to show in a Text Block node the text to which the resource ID
# in name points, bind the Text property of that Text Block node to this
# expression.
acquire({DataContext.item.name})
# If the node that has this binding has keyboard focus, returns a brush with
# resource ID Focused Brush. Otherwise returns a brush with resource ID Default
# Brush.
# For example, to visually indicate when a 2D node has focus, bind the Background
# Brush property of that node to this expression.
{@./Node.Focused} ? acquire("Focused Brush") : acquire("Default Brush")
|
animate¶
Binds a property value to a piecewise function that you define in an Animation Data item. See Using piecewise functions in bindings.
animate
takes two arguments: the property to which you are binding the Animation Data item, and the resource ID or kzb URL of the Animation Data item where you define the piecewise function that you want to use to set the value of the bound property.
When you use a resource ID, you have to place the Animation Data item to a resource dictionary where the node that contains the binding can access it. See Using resource dictionaries.
For example, you can use the Animate
function to set the needle in a gauge to move faster between values 0 and 100 than it does for values larger than 100.
Syntax |
|
||||
Parameters |
|
||||
Examples |
continueIf¶
Determines whether to continue the execution of a binding:
If the expression that you pass to the function evaluates to
false
, stops executing the binding and does not modify the value of the target property.If the expression that you pass to the function evaluates to
true
, continues to execute the binding.
For example, use this function to avoid updating the properties of a node when a binding receives invalid input from a data source.
Syntax |
|
||
Parameters |
|
||
Examples |
# If the value of the Text property in the Text Box 2D node represents a
# positive number, this binding writes that value to its target property.
# If the value of the Text property does not represent a positive number,
# this binding does not change the value of its target property.
textInput = {@../Text Box 2D/TextConcept.Text}
continueIf(int(textInput) > 0)
textInput
# If the value of the speed data object is a positive integer, this binding
# writes that value to its target property.
# If the value of the speed data object is negative, this binding does
# not change the value of its target property.
continueIf({DataContext.gauges.speed} >= 0)
{DataContext.gauges.speed}
# If the magnitude of the Layout Transformation Scale of the 3D node to which
# you add this binding is less than 5, returns a color value.
# For example, you can bind the Ambient Color property of a 3D node to this
# binding expression.
maxScale = 5
scaleX = {@./Node3D.LayoutTransformation}.scaleX
scaleY = {@./Node3D.LayoutTransformation}.scaleY
scaleZ = {@./Node3D.LayoutTransformation}.scaleZ
scale = sqrt(scaleX * scaleX + scaleY * scaleY + scaleZ * scaleZ)
continueIf(scale < maxScale)
color = linearTosRGB(Color4(0.0, 0.5, 0.8, 1))
color
|
Accessor functions¶
getCurrentValue¶
Gets the current value of the property that you want to bind. Use this function to modify the value of the property that you bind.
Syntax |
|
Returns |
the current value of the target property |
Examples |
# Binds a property field of the property, which you set as the target property
# in the Binding Editor, to the Translation X property field of the same
# property.
# For example, to bind the Render Transformation Translation Y property field
# of a node to the Render Transformation Translation X property field, in the
# Binding Editor set the Property to Render Transformation
# and Property Field to Translation Y.
getCurrentValue().translationX
|
getField¶
Gets an element in a vector or matrix.
Syntax |
|
||||
Parameters |
|
||||
Returns |
float: the element in the vector or matrix |
||||
Examples |
setField¶
Sets the value of an element in a vector or matrix.
Syntax |
|
||||||
Parameters |
|
||||||
Examples |
getRow¶
Gets a row vector in a matrix.
Syntax |
|
||||
Parameters |
|
||||
Returns |
Vector3, Vector4: the row in the matrix |
||||
Examples |
setRow¶
Sets a row vector in a matrix.
Syntax |
|
||||||
Parameters |
|
||||||
Examples |
getColumn¶
Gets a column vector in a matrix.
Syntax |
|
||||
Parameters |
|
||||
Returns |
Vector3, Vector4: the column in the vector or matrix |
||||
Examples |
setColumn¶
Sets a column vector in a matrix.
Syntax |
|
||||||
Parameters |
|
||||||
Examples |
Math functions¶
abs (absolute value)¶
Calculates the absolute value of a number or a variable. The absolute value of a number is always positive.
ceil (ceiling)¶
Calculates the closest integer value that is greater than or equal to the value of the parameter.
clamp¶
Constrains a value to lie between two values. clamp
returns the same value as min(max(value, low), high)
.
Syntax |
|
||||||
Parameters |
|
||||||
Returns |
The same type as the Casts between integer, float, and boolean are implicit. |
||||||
Examples |
floor¶
Calculates the closest integer value that is less than or equal to the value of the parameter.
max (maximum)¶
Determines the larger of the two values and returns the larger value.
Syntax |
|
||||
Parameters |
Note Only one of the parameters can be boolean, but not both. |
||||
Returns |
the same type as parameters, float if one of parameters is float, otherwise int |
||||
Examples |
min (minimum)¶
Determines the smaller of the two values and returns the smaller value.
Syntax |
|
||||
Parameters |
Note Only one of the parameters can be boolean, but not both. |
||||
Returns |
the same type as parameters, float if one of parameters is float, otherwise int |
||||
Examples |
mod (modulo)¶
Calculates the modulo that is the remainder when one number is divided by another using the mathematical modulo congruence function.
See rem (remainder).
Syntax |
|
||||
Parameters |
Note Only one of the parameters can be boolean, but not both. |
||||
Returns |
the same type as parameters, float if one of parameters is float, otherwise int |
||||
Examples |
pow (power)¶
Calculates exponential expressions. It is an efficient way for multiplying numbers by themselves.
Syntax |
|
||||
Parameters |
|
||||
Returns |
the same type as parameter |
||||
Examples |
rem (remainder)¶
Calculates the remainder when one number is divided by another rounded towards zero.
See mod (modulo).
Syntax |
|
||||
Parameters |
Note Only one of the parameters can be boolean, but not both. |
||||
Returns |
the same type as parameters, float if one of parameters is float, otherwise int |
||||
Examples |
round¶
Calculates the closest integer.
sign¶
Calculates the sign value of a number or a variable:
If the number is negative, the result is -1.
If the number is 0, the result is 0.
If the number is positive, the result it 1.
sqrt (square root)¶
Calculates the square root of a number. The square root value of a number is always positive.
Trigonometric functions¶
acos (inverse cosine)¶
Calculates the inverse cosine of a value.
asin (inverse sine)¶
Calculates the inverse sine of a value.
atan (inverse tangent)¶
Calculates the inverse tangent of a value.
atan2 (two-argument inverse tangent)¶
Calculates the inverse tangent of two numbers.
cos (cosine)¶
Calculates the cosine of an angle.
sin (sine)¶
Calculates the sine of an angle.
sinc (sine cardinal)¶
Calculates the unnormalized sine cardinal of an angle.
tan (tangent)¶
Calculates the tangent of an angle.
Interpolation functions¶
linearStep¶
Performs linear interpolation between two values. linearStep
returns the same value as clamp(0, 1, (value - low) / (high - low))
.
Syntax |
|
||||||
Parameters |
|
||||||
Returns |
The same type as the For example, for float:
|
||||||
Examples |
mix¶
Performs a linear interpolation between two values using a value to weight between them. Kanzi computes the result using this function: value1 * (1 - weight) + value2 * weight
.
Syntax |
|
||||||
Parameters |
|
||||||
Returns |
the same type as the |
||||||
Examples |
# Returns a color property value that is the result of the linear
# interpolation between the values of the Diffuse Color property
# of the Sphere and Box nodes. The expression uses the Value
# property of the Slider node to set the weight.
mix({#Sphere/Diffuse}, {#Box/Diffuse}, {#Slider/RangeConcept.Value})
|
smoothStep¶
Performs a smooth Hermite interpolation between low
and high
values using the value
to weight between them, when low
< value
< high
.
smoothStep
returns the same value as:
Use smoothstep interpolation when you want a threshold function with a smooth transition.
See smootherStep.
Syntax |
|
||||||
Parameters |
|
||||||
Returns |
the same type as the |
||||||
Examples |
smootherStep¶
Performs a sigmoidal Hermite interpolation between low
and high
values using the value
to weight between them, when low
< value
< high
.
smootherStep
returns the same value as:
Use smootherstep interpolation when you want a threshold function with a smooth transition.
See smoothStep.
Syntax |
|
||||||
Parameters |
|
||||||
Returns |
the same type as the |
||||||
Examples |
step¶
Compares a value to a threshold.
Syntax |
|
||||
Parameters |
|
||||
Returns |
The same type as For example, for float:
|
||||
Examples |
Vector functions¶
length (magnitude)¶
Calculates the length (or magnitude) of a vector.
normalize¶
Calculates the normalized, or unit vector, which has the same direction as the input vector, but has a length of 1.
cross (vector product)¶
Calculates the vector product of two Vector3 or Vector4 values.
Syntax |
|
||||
Parameters |
For Vector4 the operation ignores the last, or |
||||
Returns |
the same type as parameters |
||||
Examples |
dot (scalar product)¶
Calculates the scalar product of two vectors of the same length.
Matrix and transformation functions¶
createRotation¶
Creates rotation in either the Layout Transformation or the Render Transformation property using the quaternion data type. The quaternion data type is used for rotation property fields. See createRotationX, createRotationY, createRotationZ, rotate, rotateX, rotateY, rotateZ.
createRotationX¶
Creates rotation in the Layout Transformation or the Render Transformation property on the X axis using quaternion data type. The quaternion data type is used for rotation property fields. See createRotation, createRotationY, createRotationZ, rotate, rotateX, rotateY, rotateZ.
createRotationY¶
Creates rotation in the Layout Transformation or the Render Transformation property on the Y axis using quaternion data type. The quaternion data type is used only for rotation property fields. See createRotation, createRotationX, createRotationZ, rotate, rotateX, rotateY, rotateZ.
createRotationZ¶
Creates rotation in the Layout Transformation or the Render Transformation property on the Z axis using quaternion data type. The quaternion data type is used only for rotation property fields. See createRotation, createRotationX, createRotationY, rotate, rotateX, rotateY, rotateZ.
extractEulerX¶
Extracts the X Euler angle from the Layout Transformation or the Render Transformation properties. You can use extractEulerX
for rotation property fields. extractEulerX
takes a quaternion data type value as a parameter and returns float data.
When you set an angle in an SRT3D property, the angle is stored in quaternion data type. Because the extractEulerX
function extracts the angle from the quaternion, the returned Euler angle is not the same as the angle originally set in the SRT3D property. Both angles define the same rotation.
See extractEulerY, extractEulerZ, createRotation, createRotationX, createRotationY, rotate, rotateX, rotateY, rotateZ.
Syntax |
|
||
Parameters |
|
||
Returns |
float |
||
Examples |
extractEulerY¶
Extracts the Y Euler angle from the Layout Transformation or the Render Transformation properties. You can use extractEulerY
for rotation property fields. extractEulerY
takes a quaternion data type value as a parameter and returns float data.
When you set an angle in an SRT3D property, the angle is stored in quaternion data type. Because the extractEulerX
function extracts the angle from the quaternion, the returned Euler angle is not the same as the angle originally set in the SRT3D property. Both angles define the same rotation.
See extractEulerX, extractEulerZ, createRotation, createRotationX, createRotationY, rotate, rotateX, rotateY, rotateZ.
Syntax |
|
||
Parameters |
|
||
Returns |
float |
||
Examples |
extractEulerZ¶
Extracts the Z Euler angle from the Layout Transformation or the Render Transformation properties. You can use extractEulerZ
for rotation property fields. extractEulerZ
takes a quaternion data type value as a parameter and returns float data.
When you set an angle in an SRT3D property, the angle is stored in quaternion data type. Because the extractEulerX
function extracts the angle from the quaternion, the returned Euler angle is not the same as the angle originally set in the SRT3D property. Both angles define the same rotation.
See extractEulerX, extractEulerY, createRotation, createRotationX, createRotationY, rotate, rotateX, rotateY, rotateZ.
Syntax |
|
||
Parameters |
|
||
Returns |
float |
||
Examples |
extractSRT2D¶
Extracts a 2D transformation from a 3x3 matrix.
extractSRT3D¶
Extracts a 3D transformation from a 4x4 matrix.
Syntax |
|
||
Parameters |
|
||
Returns |
Srt3D |
||
Examples |
inverse¶
Calculates the inverse matrix of a matrix or SRT, or the inverse of a quaternion. Kanzi uses the quaternion data type for the rotation property fields of the Layout Transformation and Render Transformation properties.
Syntax |
|
||
Parameters |
|
||
Returns |
|
||
Examples |
rotate¶
Creates whole SRT3D rotation property fields. You can use the SRT3D data type with the Layout Transformation and the Render Transformation properties. See rotateX, rotateY, rotateZ, createRotation, createRotationX, createRotationY, createRotationZ, getCurrentValue.
rotateX¶
Creates whole SRT3D rotation property fields on the X axis. You can use the SRT3D data type with the Layout Transformation and the Render Transformation properties. See rotate, createRotation, createRotationX, createRotationY, createRotationZ, getCurrentValue.
rotateY¶
Creates whole SRT3D rotation property fields on the Y axis. You can use the SRT3D data type with the Layout Transformation and the Render Transformation properties. See rotate, createRotation, createRotationX, createRotationY, createRotationZ, getCurrentValue.
rotateZ¶
Creates whole SRT3D rotation property fields on the Z axis. You can use the SRT3D data type with the Layout Transformation and the Render Transformation properties. See rotate, createRotation, createRotationX, createRotationY, createRotationZ, getCurrentValue.
transform¶
Uses matrix or SRT to transform a vector.
Syntax |
|
||||
Parameters |
|
||||
Returns |
the same type as the |
||||
Examples |
For example, the transform of Vector2 by Srt2D follows this equation where S is scale, R is rotation, and T is translation:
transform(Srt2D(SX,SY,R,TX,TY),Vector2(X,Y))=(SX∗(cos(R)∗X−sin(R)∗Y)+TXSY∗(sin(R)∗X+cos(R)∗Y)+TY) This is the matrix representation of the equation:
[SX∗cos(R)−SY∗sin(R)TXSY∗sin(R)SY∗cos(R)TY001]∗[XY1] |
transpose¶
Calculates the transpose of a matrix.
Color functions¶
hslToSrgb¶
Converts a value from HSL color space to sRGB color space. This function does not convert the alpha channel of a color value.
For example, use this function to convert an HSL color value, which comes from a data source, to sRGB color space before you set the Brush Color property of a node to that color.
Syntax |
|
||
Parameters |
|
||
Returns |
If the parameter is Vector4, returns Vector4. If the parameter is Vector3, returns Vector3. |
||
Examples |
# Interprets the values of three sliders as hue, saturation, and lightness
# values and converts the resulting HSL color through sRGB color space to
# linear color space.
# For example, to fill an Empty Node 2D node with the color, bind the
# Brush Color property of that node to this binding expression.
#
hslVec = Vector4(0, 0, 0, 1)
# Get the hue from the value of a slider whose range is 0 .. 360.
hslVec.x = {@../Hue Slider/RangeConcept.Value} / 360
# Get the saturation from the value of a slider whose range is 0 .. 100.
hslVec.y = {@../Saturation Slider/RangeConcept.Value} / 100
# Get the lightness from the value of a slider whose range is 0 .. 100.
hslVec.z = {@../Lightness Slider/RangeConcept.Value} / 100
# Convert the color from HSL to sRGB color space.
srgbColor = Color4(hslToSrgb(hslVec))
# Convert the color from sRGB to linear color space.
sRGBToLinear(srgbColor)
![]() # Interprets the translation of a 3D node as an HSL color and converts that
# color to sRGB.
# For example, when you bind the Ambient Color property of a 3D node to this
# binding expression, the color changes when you move the node along the 3D
# axes within the range 0 .. 10:
# - Hue changes along the x axis.
# - Saturation increases along the y axis.
# - Lightness increases along the z axis.
x = {@./Node3D.RenderTransformation}.translationX
y = {@./Node3D.RenderTransformation}.translationY
z = {@./Node3D.RenderTransformation}.translationZ
position = Vector3(0, 0, 0)
position.x = abs(x) / 10
position.y = abs(y) / 10
position.z = abs(z) / 10
rgbVector = hslToSrgb(position)
output = Color4(0, 0, 0, 1)
output.r = rgbVector.x
output.g = rgbVector.y
output.b = rgbVector.z
sRGBToLinear(output)
|
linearTosRGB¶
Converts a value from linear color space to sRGB color space. This function does not convert the alpha channel of a color value.
For example, use this function in a uniform binding in a material type whose shader expects sRGB color.
Syntax |
|
||
Parameters |
|
||
Returns |
the same type as the input parameter |
||
Examples |
# Converts the value of the Diffuse Color property from linear color space to
# sRGB color space.
# When you bind in a material type a color uniform to this binding expression,
# Kanzi writes the color value to the render state and uses it as the value of
# the color uniform when rendering the nodes that use the material type.
linearTosRGB({./Diffuse})
|
premultiplyColor¶
Multiplies the values of the RGB channels in a color by the value of the alpha channel:
Color4(color.r * color.a, color.g * color.a, color.b * color.a, color.a)
srgbToHsl¶
Converts a value from sRGB color space to HSL color space. This function does not convert the alpha channel of a color value.
For example, use this function to show the saturation value of a color in a Text Block node.
To access the components of an HSL color value hslVector
, use:
hslVector.x
for the huehslVector.y
for the saturationhslVector.z
for the lightness
Syntax |
|
||
Parameters |
|
||
Returns |
If the parameter is Vector4 or color, returns Vector4. If the parameter is Vector3, returns Vector3. |
||
Examples |
# Converts the value of the Brush Color property in the parent node from linear
# color space to HSL color space and prints the saturation value of the color in
# percentage. For example, you can bind this expression to the Text property of
# a Text Block node.
srgbColor = linearTosRGB({@../ColorBrush.Color})
hslVector = srgbToHsl(srgbColor)
string(int(hslVector.y * 100)) + "%"
|
sRGBToLinear¶
Converts a value from sRGB color space to linear color space. This function does not convert the alpha channel of a color value.
For example, use this function to convert a value to linear color space before assigning the value to the red, green, or blue channel of a color property.
Syntax |
|
||
Parameters |
|
||
Returns |
the same type as the input parameter |
||
Examples |
# Converts the value of the Ambient Color property from sRGB color space to
# linear color space.
# When you bind in a material type a color uniform to this binding expression,
# Kanzi writes the color value to the render state and uses it as the value of
# the color uniform when rendering the nodes that use the material type.
sRGBToLinear(getAmbient())
|
Range functions¶
A range property type stores a collection of values. Use ranges in bindings to:
Read individual values from ranges.
Manipulate multiple values at the same time.
Write multiple values to array outputs.
createView¶
Creates a view over a range. The view refers to the values of the input range but its length is limited.
You can create multiple views for the same range
. When you iterate the view, the iteration refers to locations in the input range
.
Syntax |
|
||||||
Parameters |
|
||||||
Returns |
a range that refers to the values of the input range, but whose length is limited to the minimum of the length of the input |
||||||
Examples |
# This is the default PointLightColor uniform binding in a material type that uses
# lights. The binding creates a view over the range of Point Light nodes in the
# scene and accesses the Point Light Color property of each Point Light node in that
# view. The length of the view is determined by the number of Point Light nodes
# supported by the material type.
pointLightsView = createView<OutputSize>({##RenderPass/DrawObjectsRenderPass.PointLights})
{pointLightsView ... PointLightColor}
# Modify the default PointLightColor uniform binding in a material type that uses
# lights. Set the length of the view over the range of Point Light nodes to the
# value of the MyLengthProperty set in a node that uses the material type that has
# this binding.
# This binding uses the createView(range, length) syntax where length can be
# a variable or constant value.
length = {./MyLengthProperty}
pointLightsView = createView({##RenderPass/DrawObjectsRenderPass.PointLights}, length)
{pointLightsView ... PointLightColor}
# Modify the default PointLightColor uniform binding in a material type that uses
# lights. Set the length of the view over the range of Point Light nodes to 2.
# This binding uses the createView<constantLength>(range) syntax where constantLength
# is a constant value.
pointLightsView = createView<2>({##RenderPass/DrawObjectsRenderPass.PointLights})
{pointLightsView ... PointLightColor}
|
evaluate¶
Converts a range iterator to an evaluation of that range. Use this function to step through a collection of values stored in a range property.
The evaluate
function advances the range iterator and returns the location in the range iterator before the advance.
For locations in the range iterator the evaluate
function does not modify the iterator, but returns the next iteration location.
Use the splitString function to create a range iterator to evaluate.
Syntax |
|
||
Parameters |
|
||
Returns |
range: evaluation of the input range |
||
Examples |
# Sets the 2D Render Transformation property Translation property fields
# to the values that the user enters in the Text Box 2D node.
# For example, "100, 50" sets the Render Transformation property:
# - Translation X property field to 100
# - Translation Y property field to 50
renderTransformation = getCurrentValue()
stringRange = splitString({@../Text Box 2D/TextConcept.Text}, ",")
renderTransformation.translationX = float(stringRange)
evaluate(stringRange)
renderTransformation.translationY = float(stringRange)
renderTransformation
# This example is equivalent to the previous example.
renderTransformation = getCurrentValue()
stringRange = splitString({@../Text Box 2D/TextConcept.Text}, ",")
x = evaluate(stringRange)
y = evaluate(stringRange)
renderTransformation.translationX = float(x)
renderTransformation.translationY = float(y)
renderTransformation
|
splitString¶
Splits a text string into a collection of substrings and returns that collection as a range iterator that you can use to step through the collection of substrings. Use the evaluate function to return the substrings one at a time.
See Using bindings to split text into parts.
Syntax |
|
||||
Parameters |
|
||||
Returns |
Range |
||||
Examples |
Texture functions¶
Textures are resources that you can use in rendering to represent an image. Use the texture functions to access the properties of textures.
textureGetAddressingMode¶
Gets the addressing mode of a texture that you can set using either:
Wrap Mode property in a texture resource.
Addressing Mode property in a Composition Target Render Pass render pass.
For example, use this function to get the addressing mode of a texture when you want to use that addressing mode as input for decision making in other bindings.
Syntax |
|
||
Parameters |
|
||
Returns |
integer:
|
||
Examples |
textureGetAnisotropyLevel¶
Gets the anisotropy level of a texture, which you set using the Anisotropy property in a texture resource. For example, use this function to get the anisotropy level of a texture resource when you want to use that anisotropy level as input for decision making in other bindings.
Syntax |
|
||
Parameters |
|
||
Returns |
integer:
|
||
Examples |
textureGetDepthCompareFunction¶
Gets the depth compare function of a Render Target Texture resource to which you render a result texture of a Composition Target Render Pass render pass. For example, use this function to get the depth compare function of a texture resource when you want to use that function as input for decision making in other bindings.
Syntax |
|
||
Parameters |
|
||
Returns |
integer:
|
||
Examples |
textureGetFilterMode¶
Gets the filter mode of a texture that you can set using either:
Minification Filter property in a texture resource.
Filter Mode property in a Composition Target Render Pass render pass.
For example, use this function to get the filter mode of a texture resource when you want to use that filter mode as input for decision making in other bindings.
Syntax |
|
||
Parameters |
|
||
Returns |
integer:
|
||
Examples |
textureGetHeight¶
Gets the height of a texture. For example, use this function when you want to use the height of a texture resource to set the height of a node.
Syntax |
|
||
Parameters |
|
||
Returns |
integer If the input parameter does not hold a texture resource, returns -1. |
||
Examples |
textureGetMipmapMode¶
Gets the mipmap mode of a texture, which you set using the Mipmap Mode property in a texture resource or Composition Target Render Pass render pass. For example, use this function to get the mipmap mode of a texture resource when you want to use that mipmap mode as input for decision making in other bindings.
Syntax |
|
||
Parameters |
|
||
Returns |
integer:
|
||
Examples |
textureGetMultisampleLevel¶
Gets the multisample level of a Render Target Texture resource. For example, use this function to get the multisample level of a render target texture when you want to use that multisample level as input for decision making in other bindings.
The multisample level is meaningful only if the target platform supports implicit multisampling. The renderbuffer multisampling used by the Composition Target Render Pass resolves the samples as part of a blit operation to a Single Texture resource, which is why the result texture is not multisampled. See Using multisampling.
Syntax |
|
||
Parameters |
|
||
Returns |
integer:
|
||
Examples |
textureGetPixelFormat¶
Gets the pixel format of a texture. For example, use this function to get the pixel format of a texture resource when you want to use that pixel format as input for decision making in other bindings.
Syntax |
|
||
Parameters |
|
||
Returns |
integer The return value corresponds to a value of the If the input parameter does not hold a texture resource, returns -1. |
||
Examples |
textureGetSize¶
Gets the size of a texture. For example, use this function when you want to use the size of a texture resource to set the size of a node.
Syntax |
|
||
Parameters |
|
||
Returns |
Vector2 If the input parameter does not hold a texture resource, returns Vector2(-1.0f, -1.0f). |
||
Examples |
textureGetWidth¶
Gets the width of a texture. For example, use this function when you want to use the width of a texture resource to set the width of a node.
Syntax |
|
||
Parameters |
|
||
Returns |
integer If the input parameter does not hold a texture resource, returns -1. |
||
Examples |
Uniform binding functions¶
In a material type vertex and fragment shaders define the uniforms and property types that you can use in that material. When rendering 3D nodes with a specific material type, uniform bindings allow Kanzi to write values to the render state and use those values for uniforms and property types.
See Shader uniforms and Uniform bindings.
To reduce memory consumption and improve performance, Kanzi provides binding functions for the most common uniforms. Kanzi executes every frame all bindings that use these functions.
getAmbient¶
Gets the value of the Ambient Color property.
Syntax |
|
Returns |
Color: the value of the Ambient Color property |
getCameraPosition¶
Gets the camera location in world coordinates.
Syntax |
|
Returns |
Vector 3D: the camera location in world coordinates |
getCameraWorldMatrix¶
Gets the premultiplied matrix kzCameraMatrix * kzWorldMatrix
, where:
kzCameraMatrix
transforms a point from world (global) space to view (camera) space.kzWorldMatrix
transforms a point from local space to world (global) space. See getWorldMatrix.
Syntax |
|
Returns |
Matrix 4x4: the premultiplied matrix |
getNormalMatrix¶
Gets the matrix to transform object normals to world coordinates.
Syntax |
|
Returns |
Matrix 4x4: the matrix to transform object normals to world coordinates |
getProjectionCameraWorldMatrix¶
Gets the premultiplied matrix kzProjectionMatrix * kzCameraMatrix * kzWorldMatrix
, where:
kzProjectionMatrix
transforms a point from view space to screen space.kzCameraMatrix
transforms a point from world (global) space to view (camera) space.kzWorldMatrix
transforms a point from local space to world (global) space. See getWorldMatrix.
Syntax |
|
Returns |
Matrix 4x4: the premultiplied matrix |
getViewPosition¶
Gets the homogeneous position vector kzViewPosition
that you can use to calculate the view direction as kzWorldMatrix * vec4(kzPosition.xyz, 1.0) * kzViewPosition.w - kzViewPosition.xyz
, where:
kzWorldMatrix
transforms a point from local space to world (global) space. See getWorldMatrix.kzViewPosition.w
determines whether the vector is a position in space (w==1) or a direction (w==0).
Syntax |
|
Returns |
Vector 4D: the homogeneous position vector |
getWorldMatrix¶
Gets the transformation matrix to transform from local coordinates to world (global) coordinates.
Syntax |
|
Returns |
Matrix 4x4: the transformation matrix to transform from local coordinates to world (global) coordinates |
Common binding expressions¶
Property bindings¶
To bind a property to another property, enter in curly braces:
The relative path to the node which contains the property to which you want to bind.
A forward slash.
The name of the source property.
Tip
When you use the @ sign in a binding expression before the path to a node, Kanzi Studio:
Checks whether the path is valid and shows an error message in the Binding Editor if the path is not valid.
Updates the path in the binding expression whenever the location between the source and the target nodes in the node tree changes.
With the @ sign you can create bindings only within the same prefab, not between prefabs.
You can drag property names from the Properties to the Binding Editor.
You can use the operators and parentheses with property values and property field values.
Syntax |
|
||||
Parameters |
|
||||
Examples |
# Binds each vector of a property to the Render Transformation property
# Translation X and Translation Y property fields of the current node.
# In the Binding Editor set the Target Property to a property that uses the
# Vector2D data type. For example, use the Horizontal Margin property.
x = {@./Node3D.RenderTransformation}.translationX
y = {@./Node3D.RenderTransformation}.translationY
myVector = Vector2(0.0, 0.0)
myVector.vectorX = x
myVector.vectorY = y
myVector
|
Property field bindings¶
To bind a property to a property field of property, enter in curly braces the relative path to the node, followed by a forward slash and property name, followed by a period and the name of a property field.
To bind a property field of a property to another property field of that property in the same node, use the getCurrentValue()
function to get the value of that property. See getCurrentValue.
For property fields that are not common, instead of the property field name use N
or VectorN
, where N
is X
, Y
, Z
, or W
denoting the order in which the property is listed in the Properties. You can use the operators and parentheses with property values and property field values.
When you want to bind a property to a property field, use these names in the binding expression.
Description |
Property field label |
Property field names |
---|---|---|
Color property red color channel value |
R |
colorR, r |
Color property green color channel value |
G |
colorG, g |
Color property blue color channel value |
B |
colorB, b |
Color property alpha channel value |
A |
colorA, a |
Value of the 3D node rotation around the X, Y, and Z axes which you set using rotation functions. See createRotation, createRotationX, createRotationY, createRotationZ, rotate, rotateX, rotateY, and rotateZ. |
Rotation |
rotation |
Value of the 2D node rotation around the Z axis |
Rotation R |
rotationZ |
Value of the node scale along the X axis |
Scale X |
scaleX |
Value of the node scale along the Y axis |
Scale Y |
scaleY |
Value of the node scale along the Z axis |
Scale Z |
scaleZ |
Value of the node location along the X axis |
Translation X |
translationX, x |
Value of the node location along the Y axis |
Translation Y |
translationY, y |
Value of the node location along the Z axis |
Translation Z |
translationZ, z |
The first property field of a property |
X |
vectorX, x |
The second property field of a property |
Y |
vectorY, y |
The third property field of a property |
Z |
vectorZ, z |
The fourth property field of a property |
W |
vectorW, w |
Syntax |
|
||||||
Parameters |
|
||||||
Examples |
# Assigns custom property MyFloatPropertyType to the red channel of a color
# property. The sRGBToLinear function converts the value from sRGB color space
# to linear color space before assigning it to the color property field.
color = getCurrentValue()
color.r = sRGBToLinear({@./MyFloatPropertyType})
color
# Point Light and Spot Light nodes have an attenuation property that
# has three property fields: Constant, Linear, and Quadratic.
# For example, for the Point Light Attenuation:
# To bind to the first property field (Constant)
{../Light/PointLightAttenuation}.vectorX
# To bind to the second property field (Linear)
{../Light/PointLightAttenuation}.vectorY
# To bind to the third property field (Quadratic)
{../Light/PointLightAttenuation}.vectorZ
# Binds each vector of a property to the Render Transformation property
# Translation X and Translation Y property fields of the current node.
# In the Binding Editor set the Target Property to a property that uses the
# Vector2D data type. For example, use the Horizontal Margin property.
x = {@./Node3D.RenderTransformation}.translationX
y = {@./Node3D.RenderTransformation}.translationY
myVector = Vector2(0.0, 0.0)
myVector.vectorX = x
myVector.vectorY = y
myVector
|
Prefab root bindings¶
A node prefab or a render pass prefab can contain a tree of nodes or render passes, each with their own properties. When you edit the nodes or render passes in a prefab or any of its instances, you change those nodes or render passes in all instances of that prefab. However, you can customize individual instances of the prefab to have individual values by overriding the values in the default prefab. For example, when you create a prefab for a contact list entry, you want to show a different name, number, and photo for each contact list entry.
To bind a property of any node or render pass in a prefab to a property in the root of an instance of that prefab, in the binding expression enter in curly braces ##Template
, followed by a forward slash and the name of the property in the root of the prefab instance to which you want to bind.
For example, use the ##Template
binding syntax when you have a Text Block node in a Button prefab and you want to show different text in different instances of that prefab.
Tip
You can let Kanzi Studio create a prefab root binding for you. When you select any node in a prefab or any render pass in a render pass prefab, and in the Properties click next to a property, Kanzi Studio:
Creates from that property a custom property.
Adds the custom property to the prefab and shows the custom property as a frequently used property in each instance of the prefab.
Creates in the node or render pass the
##Template
binding to the custom property in the prefab root.
Alias bindings¶
To bind a property to an alias, enter in curly braces the #
sign followed by the alias name, followed by a forward slash and property name of the item to which the alias points. See Using aliases.
Syntax |
|
||||
Parameters |
|
||||
Examples |
Data source bindings¶
To bind a data object to a property or a property field, enter in curly braces DataContext
followed by a period, followed by the data object to which you want to bind the property or property field. Use a period to access child data objects.
Syntax |
|
||
Parameters |
|
||
Examples |
Grid Layout bindings¶
To set the size of columns and rows in a Grid Layout node using bindings, enter in quotation marks each value followed by a semicolon:
Use a floating point number to specify that the size of a row or a column is fixed. This is the same as when you set the value of the Columns or Rows property in the Properties to Fixed and define the size of this column or row.
Add an asterisk prefix to specify that the size of a row or a column is proportional. This is the same as when you set the value of the Columns or Rows property in the Properties to Proportional and define the proportion of the Grid Layout this column or row takes.
Leave the definition empty to specify that the Grid Layout node automatically sets the size of a row or a column. This is the same as when you set the value of the Columns or Rows property in the Properties to Automatic.
Syntax |
|
||
Parameters |
|
||
Examples |
# This binding to the Columns property sets the width of the columns in relation
# to the total width of the Grid Layout node:
# - The width of the first column is 1/6 of the width of the Grid Layout node.
# - The width of the second column is 2/6 of the width of the Grid Layout node.
# - The width of the third column is 3/6 of the width of the Grid Layout node.
"*1.0;*2.0;*3.0;"
|
Material type binding expressions¶
Temporary variables in material type bindings¶
To refer in a material type binding expression to the result of a temporary variable binding in the same material type, enter in curly braces ##Self
, followed by a forward slash and the name of the target property of the temporary variable binding. The ##Self
syntax refers to the render value of the property used by the render passes that draw nodes using the material type.
Syntax |
|
||
Parameters |
|
||
Examples |
# This binding to a color property returns the color value obtained from the
# result of a temporary variable binding that targets the MyColorRange range
# property.
colors = splitString(string({##Self/MyColorRange}), " ")
color = Color4(0,0,0,1)
color.r = float(string(evaluate(colors)))
color.g = float(string(evaluate(colors)))
color.b = float(string(evaluate(colors)))
color
|
Render pass properties in material type bindings¶
To refer in a material type binding expression to a property in a render pass that draws nodes using the material type, enter in curly braces ##RenderPass
, followed by a forward slash and the name of the property in the render pass to which you want to bind.
Syntax |
|
||
Parameters |
|
||
Examples |
# This binding to a Matrix 4x4 property returns the inverse matrix of the product
# of the Calculated Projection Matrix and Calculated Camera Matrix properties in
# the Draw Objects Render Pass that draws nodes using the material type that has
# this binding.
projection = {##RenderPass/DrawObjectsRenderPass.ProjectionMatrix}
camera = {##RenderPass/DrawObjectsRenderPass.CameraMatrix}
inverse(projection * camera)
# This binding to a temporary variable property uses the evaluate binding function
# to step through a collection of values stored in the MyColorRange range property
# in the Draw Objects Render Pass that draws nodes using the material type that
# has this binding. The binding modifies the state of the range iterator in the
# render pass.
evaluate({##RenderPass/MyColorRange})
|
Light uniform bindings¶
In a material type vertex and fragment shaders define the uniforms and property types that you can use in that material. When rendering 3D nodes with a specific material type, uniform bindings allow Kanzi to write values to the render state and use those values for uniforms and property types.
See Using material types and Rendering.
Light property types, such as DirectionalLightColor
, SpotLightPosition
, and PointLightAttenuation
, support uniform arrays. This enables you to use multiple lights of the same type. See Uniform arrays for light property types.
A uniform binding for a light property type sets the uniform values in a render state based on the values extracted from lights that use that property type. For example, a uniform binding for the PointLightColor
property type sets the render value based on the individual values of the Point Light Color property in all Point Light nodes in the scene that light those 3D nodes that use the material type which has the binding.
To get the range that contains the value of a property in each light node of a specific type, in the binding expression enter in curly braces ##RenderPass/DrawObjectsRenderPass.[lightType]
, followed by ellipsis and the name of the property in the light nodes.
To perform accumulation operations on a range of lights use the ...
operator followed by an arithmetic operator.
See createView.
Syntax |
|
||||
Parameters |
|
||||
Examples |
# This binding to a light color uniform multiplies in each Directional Light node
# the value of the Directional Light Color property by the value of the Opacity
# property and returns the result range.
rangeA = {##RenderPass/DrawObjectsRenderPass.DirectionalLights ... DirectionalLightColor}
rangeB = {##RenderPass/DrawObjectsRenderPass.DirectionalLights ... Node.Opacity}
rangeA * rangeB
# Get the range that contains the value of the Point Light Color property in each
# Point Light node.
rangeA = {##RenderPass/DrawObjectsRenderPass.PointLights ... PointLightColor}
# Get the range that contains the value of the Opacity property in each
# Point Light node.
rangeB = {##RenderPass/DrawObjectsRenderPass.PointLights ... Node.Opacity}
# Multiply the value of the Opacity property in each Point Light node.
totalOpacity = ...* rangeB
# For each Point Light node multiply the value of the Point Light Color property
# by the multiplied opacity.
rangeA * totalOpacity
|