Volume Gradient VEX node

Calculates the gradient of a volume primitive.

See also: Volume Sample, Volume Sample from File, Volume Gradient from File

Calculates the gradient a specific volume primitive. The gradient is a vector pointing in the direction of increasing volume values. Returns 0 if “primnum” is out of range, the “filename” is invalid, or the given primitive is not a volume primitive.

Note

This node is only available in the geometry context.

If you create an SDF of an object, the gradient VOP will show the direction to the surface from any point inside the SDF.

For example, create a sphere and a point (with the help of the Add SOP). Connect the sphere to the IsoOffset SOP and change it to SDF. Next, connect the point and IsoOffset to the VOP SOP. In the VOP SOP, connect P in Globals to the N output using the Volume Gradient. In the viewport, the point normals will show you the direction. For it to work, the point must be located within the limits of the SDF field. Because the output yields the normalized data, it shows only the direction.

Usages in other examples

Example name Example for