gl-catmull-clark
gl-catmull-clark copied to clipboard
Add support for subdividing non-closed meshes
Thanks for the awesome library! I am using this to subdivide meshes from Blender on the client. When encountering a non-closed mesh, I found it to produce artifacts (see demo below).
This patch adds support for subdividing meshes which are non-closed or contain holes. The algorithm is based on step 3 and 4 here: https://graphics.stanford.edu/wikis/cs148-09-summer/Assignment3Description
Here's another reference (but it describes a different interpolation for edge points which mismatches Blender) https://rosettacode.org/wiki/Catmull%E2%80%93Clark_subdivision_surface
Before:
After:
This patch works great for me for displaying a subdivided version of the teapot model without spikes.