Length Node
Description
Outputs the euclidean length of the input vector which is the result of the following operation: Sqrt ( Dot ( Input, Input )).
Usage Examples
Distance-Based Coloring
This example demonstrates how to dynamically change an object's color based on its distance from the camera using the Length node.
The Camera Position vector (in Object space) is passed into the Length node to compute the distance between the camera and the object. The resulting distance is then clamped to a defined range [0, 20] using the Clamp node. The clamped value is passed into a Rerange node, which converts it from the source range [0, 20] to a new target range [0, 1]. Finally, the remapped value drives a Lerp node, blending smoothly between red (closer distances) and green (farther distances).
The information on this page is valid for UNIGINE 2.20 SDK.