Mesh Subdivision: Loop and Catmull-Clark

msh_150131_16x9_large

 

Computational designers who work with meshes in Rhino + Grasshopper will inevitably be familiar with Giulio Piacentino’s brilliant Weaverbird plug-in. It provides a great variety of outstanding tools for creating, managing and subdividing meshes. Using mesh subdivision and smoothing approaches allows for designers to start from coarse geometries and then rapidly transform them into fluid and organic shapes. However, Weaverbird’s implementations of the Loop and Catmull-Clark subdivision algorithms – two of the most standard methods for these approaches – lack some desirable features, specifically the ability for users to designate anchors and creases within the mesh.


 

For a design project currently underway at CITA, there has been a need to assert more local control over subdivided meshes, for which I developed this implementation of these algorithms.

It was written in C# for Grasshopper, using the Plankton halfedge mesh library developed by Daniel Piker and Will Pearson. The calculations and weights for the masks used to relocate both existing and new vertices in the subdivided mesh were set up according to the descriptions of Loop and Catmull-Clark seen in the Siggraph 2000 Mesh Subdivision course notes.

 

Logic diagrams for Catmull-Clark and Loop Subdivision algorithms (collage from siggraph 2000 course notes) & basic implementations for quads, n-gons and triangulated meshes

 

As indicated in the diagram, although interior vertices in are handled differently in both algorithms, they treat vertices on creases the same. As the identification and tracking of edges that lie along creases requires the most work in the script, this made implementing both algorithms at once fairly straighforward. One possible difference in this implementation from many others is the ability for the user to define “hard” creases. While creases will generally tend toward a spline when subdivided, here hard creases give the user an opportunity to assert specific boundaries that specified vertices will be pulled to during subdivision. Additionally, users can specify any number of hard and soft creases at a time, as well as anchor vertices. This affords a significant amount of control over the mesh geometry.

 

 

Loop subdivision, with 1. all intitial vertices anchored, 2. creases tending toward a spline on three original faces, and 3. “hard” creases on three original faces

 

ssk_150128_CatmullClark_interior2

 

msh_141129_16x9_large
Creases in a Catmull-Clark subdivision, assigned in 1. warp direction, 2. weft direction, and 3. both directions

 

In order to work with the script, you will need to download and install Plankton. When you first open the definition, you will need to right click on the C# components, select “manage assemblies”, and then locate and insert both the Plankton.dll and Plankton.gha files in. The script will then know where to find the Plankton library.

I encourage you to take, change, and otherwise work with the script as it is, and only ask that you give credit for the work here, and also that you make any scripts you derive from this also available for other people to use.

 

Subdivision