Houdini 11 VEX VEX functions

This function computes the intersection of the specified ray with the geometry.

  1. int intersect(string filename, vector orig, vector dir, vector p&, float u&, float v&)

This function computes the intersection of the specified ray with the geometry. The primitive number is returned, or -1 if there is an error. The world position of the intersection location is stored in p. The corresponding parametric location of the intersection is stored in u, v. In the case of multiple intersections, the intersection closest to the ray origin is used.

This function does not expect a normalized direction vector. Instead, it uses the length of the vector as the maximum distance. The integer result is the primitive hit.

Note

When intersections are performed against metaball geometry, it is impossible to determine the primitive number of the metaball which was hit. In this case, the function returns the number of primitives in the intersection geometry.

Contexts: all