NumberFlow, vector3 nodes
These nodes provide various operations on 3D vectors.
- Adds two vectors.
- Add Float
- Adds a float to all three axes of a vector.
- Subtracts the second vector from the first.
- Subtract Float
- Subtracts a float from all three axes of a vector.
- Multiplies all three axes of a vector by a float factor.
- Computes the cross product of two vectors.
- Computes the dot product of two vectors.
- From Floats
- Sets the three axes of a vector individually.
- Sphere ↘
Converts (longitude, latitude) coordinates into a point on the unit sphere.
The example uses U for longitude and V for latitude and is converted to an RGB normal map.
- Computes the length of a vector.
- Square Length
- Computes the square length of a vector. This is faster than Length because it does not
need to compute a square root.
- Negates a vector.
- Normalizes a vector.
You can extract single axis components as floats or set individual axis components of a vector.
- Get X
- Extracts the X axis component from a vector.
- Get Y
- Extracts the Y axis component from a vector.
- Get Z
- Extracts the Z axis component from a vector.
- Set X
- Sets the X axis component of a vector.
- Set Y
- Sets the Y axis component of a vector.
- Set Z
- Sets the Z axis component of a vector.
- X + Y
- Adds the X and Y component of a vector.
- X × Y
- Multiplies the X and Y component of a vector.
- X - Y
- Subtracts Y component of a vector from its X component.
- Y - X
- Subtracts X component of a vector from its Y component.
These nodes convert normals to colors suitable for storage in textures.
Values in the -1–1 range are converted to the 0–1 range. Which color channels are used
depends on the format.
There are output nodes that generate normal maps for you.
You'd only use these nodes if you need to manually compute normals.
- Normal RGB
Stores XYZ in RGB. This is the traditional normal map format.
- Normal DXT5nm
Stores Y in G and X in A, leaving Z out. R and B are unused.
Requires reconstructing Z in the shader, but works well with DXT5 compression.
Unity uses this format internally on most platforms.
Computes normals based on a cubemap direction and a height. Produces an object-space normal vector.
This node uses derivatives. The height value will be computed four times with slightly different directions, which is used to compute the normal. For this to make any sense, this node and the height value node must use the same cubemap input.
This image shows object-space normals with RBG encoding. From left to right, the directions are positive X, negative X, positive Y, negative Y, positive Z, and negative Z.