Skip to content

Decimate curves

You've got lots of curves in the LOP context and want to decimate without going back to SOPs? You are in luck!, USD stores 'curveVertexCounts' array with number of points per each primitive. We can modify this array by removing unwanted primitives

lop-decimate-curve
VEXpression
int nums = usd_attriblen(0, @primpath, "curveVertexCounts");
int curve_vtx_num[] = usd_attrib(0, @primpath, "curveVertexCounts");
i[]@curveVertexCounts = {};
for (int i=0; i<nums; ++i){
    if (rand(i+ch("seed")) < ch("prune_ammount"))
        push(i[]@curveVertexCounts, curve_vtx_num[i]);
}