Swizzle
Performs an arbitrary permutation of the channels of the input stream, returning a new stream of the specified type.
Parameter Types
Parameter descriptions
InThe input value.
ChannelsA string of
1-4characters that determine the permutation to perform. These characters can be “r”, “g”, “b”, or “a” if theInparameter is a color input, or “x”, “y”, “z”, or “w” for vector inputs. Use “r” or “x” if the input is a float.
Discussion
The Swizzle node determines its output by first looking at the Channels parameter. Each character in the Channel string represents one of the channels of the In parameter. For example, if you pass in a vector3 of (1, 5, 10) as the In parameter, “x” refers to 1, y to 5, and z to 10. The order of the characters determines how the channels of the input switch around to create the output. For the previous example, if the Channels parameter is “zzz”, the output is (10, 10, 10).
The table below shows additional examples of the swizzle node process:
In | Channels | Out |
|---|---|---|
Vector3: (1, 5, 10) | zzz | Vector3: (10, 10, 10) |
Vector3: (1, 5, 10) | zyx | Vector3: (10, 5, 1) |
Vector2: (5, 0) | xxy | Vector3: (5, 5, 0) |
Vector3: (1, 5, 10) | zx | Vector2: (10, 1) |
Color3: (0.5, 0.8, 0) | grb | Color3: (0.8, 0.5, 0) |