I want to start a thread about my custom OP library to spark some discussions, get feedback, express concerns and difficulties. I will try to post regularly in a proper format so things are easier to see, etc.
As always feedback is welcome
Operator Name: Centroidal Points SOP
Description: Creates points at the centroid of each primitive, primitive/point group or primitive/point attribute in the input geometry.
URL: http://www.orbolt.com/asset/animatrix::centroidalPoints::1.00 [orbolt.com]
This SOP is written in VEX and is an updated version of my previous SOP that only used to create points per primitive. It's a very useful operation that's often needed and used even in the built-in operators such as the Voronoi Fracture SOP.
Unfortunately the standard method of achieving this in Houdini via the ForEach SOP is orders of magnitude slower, which is why it should either be written in VEX or C++.
Here is a performance comparison between both methods for 11K groups:
It's 120 times faster than the ForEach method.
The ForEach network only contains a single Add SOP (unconnected) that creates a single point using the centroid expression.
For 100K groups, ForEach takes close to 9 hours (aborted half way), while my SOP took close to 3 minutes, making it more than 200 times faster.
Concerns: The main issue I had when creating this SOP was generic handling of attributes in VEX, which is always the case when you want to support attributes of any type, class and size in VEX in a generic manner.
I didn't use dynamic code which is also very painful to write and was not recommended by SESI last time I checked. I wrote different code using each type separately using getattribute, addattrib, and setattrib. Unfortunately getattribute doesn't support int, and string arrays despite addattrib's support for them , so I had to comment them out in code.
Tags: center, centroid, points, create, geometry, generator, vex, wrangle, performance, bbox, dimensions, scale, pscale, groups, attributes, copy
Animatrix Operator Library1831 1 0
- Quick Links