Catmull – Clark Subdivision Algorithm Implementation

In Catmull–Clark algorithm, recursive refinement process starting with an initial mesh of any polyhedron. Each vertex within this mesh is termed as an original point. The refinement scheme includes in a series of steps aimed at enhancing the smoothness and detail of the surface.

Firstly, for every face in the mesh, a face point is calculated. This face point is determined as the average position of all the original points of the corresponding face (center of face with respect to vertices). It serves as a reference point for refining the overall shape of the surface. This process is not hard since we have a face struct including all vertex indices of corresponding face.

Secondly, for each edge in the mesh, an edge point is computed. This edge point is obtained by averaging the positions of the two neighboring face points and the two endpoints of the edge. At that point, I need to find neighbour faces of each edge and I eliminate doublings in my implementation. This process is not that competitive as the first one. All computations effectively integrates the geometric information from neighbour faces and vertices into the refinement process.

Thirdly, for every original point in the mesh, a new vertex point is calculated. This phase took significant amount of time since there are plenty of variables (F, R, P, n) , so I needed to calculate all of them in an effective way. Also, there were some double calculations I needed to handle. These calculations involves averaging:

  • The face points (calculated in step 1) of faces touching the original point
  • The midpoints of edges touching the original point
  • The original point itself

This averaging process redistributes the vertices, aiming to create a smoother surface while maintaining the overall shape and features of the original mesh. We move corresponding original point to its new location (barycenter of PR and F with respective weights (n − 3), 2 and 1)

Lastly, following these computations, new edges and faces are formed in the refined mesh. Each new face point is connected to the new edge points of the original edges defining the face. Similarly, each new vertex point is connected to the new edge points of the original edges incident on the original vertex. There are a lot of problems in that step since I created new original points and I needed to keep what current vertex should connect. I could not handle this problem properly, but I can still get some written outputs on terminal including face points, edge points an new original points(their moved locations)

Finally, new faces are defined by enclosing the edges formed in the previous steps. This iterative refinement results in a mesh with smoother surfaces and enhanced detail, achieved through the redistribution and connection of vertices based on weighted averages of neighboring geometric elements. I could not create new faces due to the problems I encounter in previous step, but I still have some written output that I attach below.