Shader Graph13- length function, distance function

1. The Position of the Camera node represents the camera coordinates, and the Position represents the coordinates of the vertices of the object. Remember to change it to Absolute World, so that Distance calculates the distance between the camera and the object. Dividing by 5 means that within 5m, the color of the object will change from black to white.

 

Next we replace the Distance node with the subtract and Length nodes, as shown below, the effect is the same as above. After the subtraction between Camera and Position, a vector is obtained, and then the size of the vector is calculated by Length.

2. Open Unreal

The reason for the parameter 500 of Divide here is that the default unit of unreal is cm, and the unit of Unity is m.

Use VectorLength to calculate the size of a vector

Guess you like

Origin blog.csdn.net/zhuziying99/article/details/130367950