- Sun 12 October 2014
- misc
- Glen Berseth

Recently I have been learning more about Polygonal meshes and operations you can perform on them. One of the first operations that can be done on a mesh, that is a kind of cool, is subdivision. The basic idea is that you have a mesh that is very course (few polygons, rough) and we want a method that can construct a smoother mesh from this course mesh. This has been a popular method for constructing extremely smooth meshes for movies for many years.

This is an example very course mesh of a Camel. This mesh was not constructed this way by chance. An artist spent many hours adjusting verticies (points) and faces (polygons or triangles) on this mesh in order for subdivision to work well.

The Loop algorithm is a popular algorithm to perform mesh subdivision. One reason for its popularity is that it ensures that after subdivision the mesh is C2 continuous (smooth second derivative on surface) everywhere on the mesh except for at extreme points.

After lots of careful thought I decided to implement the algorithm in 3 steps.

- Add all of the new verticies for the mesh (easy)
- Take every edge and add a new point between the two points that define the edge
- Construct/fix all of the polygons in the mesh (not so easy)
- Add edges between all of the new points and update the face/polygon labels for these edges
- Most bugs came from this step
- Compute the new positions of the verticies on a copy of the mesh from 2 (almost easy)
- Simply use the old mesh to compute all of the neighbours for old points.
- Computed the weighted sum of positions from neighbours and selected point (See loop Algorithm) and assign this position on the mesh copy
- For new points I used the new mesh to get the neighbours of each new point that was in the old mesh
- Last I had to run a query to get the edge between the points from (3). This got me the edge I should use to find the last two neighbour points for the Loop Algorithm

original mesh

After one subdivision

After two

After three

final mesh

Camel mesh after simplifaction

References:

- http://www.cs.ubc.ca/labs/imager/tr/2014/CartelModeling/Cartel_website/
- https://www.graphics.rwth-aachen.de/media/papers/sqrt31.pdf
- http://research.microsoft.com/en-us/um/people/cloop/thesis.pdf