osd_limit
evaluates the point attribute in the geometry specified as a
subdivision surface along with all first and second partial derivatives.
int osd_limit(<geometry>geometry, string attrib_name, int patch_id, float u, float v, <type>&result, <type>&result_du, <type>&result_dv, <type>&result_duu, <type>&result_duv, <type>&result_dvv)
int osd_limit(<geometry>geometry, string attrib_name, int patch_id, float u, float v, float &result[], float &result_du[], float &result_dv[], float &result_duu[], float &result_duv[], float &result_dvv[])
<geometry>
When running in the context of a node (such as a wrangle SOP), this argument can be an integer representing the input number (starting at 0) to read the geometry from.
Alternatively, the argument can be a string specifying a geometry file (for example, a .bgeo
) to read from. When running inside Houdini, this can be an op:/path/to/sop
reference.
&result
The computed attribute values are stored in the variables you pass to this argument. The type of all the output variables should match the type of the attribute you are reading.
&result_du
The first partial derivative in the U-parametric direction of the computed attribute values.
&result_dv
The first partial derivative in the V-parametric direction of the computed attribute values.
&result_duu
The second partial derivative in the U-parametric direction of the computed attribute values.
&result_duv
The second mixed-partial derivative of the computed attribute values.
&result_dvv
The second partial derivative in the V-parametric direction of the computed attribute values.
Returns
1
if computing the attribute was successful, 0
if it failed.
Possible reasons for failure are:
-
The geometry contains no polygons or the topology can’t be converted using Open Subdiv
-
The attribute doesn’t exist on the input geometry.
-
The attribute size/type doesn’t match the VEX type of the
result
arguments.
Examples ¶
Generate a point cloud on the limit surface of a subdivision mesh and set vector attributes for all partial derivatives.
int npatches = osd_patchcount(file); for (int patch = 0; patch < npatches; patch++) { for (int v = 0; v < 100; v++) { vector P, du, dv, duu, duv, dvv; if (osd_limit(file, "P", patch, nrandom(), nrandom(), P, du, dv, duu, duv, dvv)) { int ptid = addpoint(geohandle, P); setpointattrib(0, "du", ptid, du); setpointattrib(0, "dv", ptid, dv); setpointattrib(0, "duu", ptid, duu); setpointattrib(0, "duv", ptid, duv); setpointattrib(0, "dvv", ptid, dvv); } } }
See also | |
subd |