volume VEX function

Returns the volume of the microvoxel containing a variable such as P.

Contexts: cop, displace, fog, light, photon, shadow, surface

See also: area, Du, Dv

  1. float volume(vector pos)

Note

This function relies on the fact that VEX “knows” that P has derivatives (dPdu, dPdv, and dPdz). Passing a literal vector instead of a special variables such as P will return 0 since VEX will not be able to access the derivatives.

You can specify optional parameters to control the computation. The optional parameter "extrapolate" controls whether to do derivative extrapolation at the edges.

Examples

Return the area of the current micro-voxel in camera space:

volume(P)

Returns 0, since the argument is not a variable VEX knows the derivatives for:

volume({0.1, 2.3, 4.5})