This is my modelling project solution to CS3242 (3D Modelling and Animation).
The project came with several universal basic, under-the-hood requirements, such as being able to implement edge traversal algorithms using Trist structures.
The "final boss" project was however freeform; I went all out and had great fun implementing the following features:
Seems rather straightforward 🙂
As the project necessitated an older OpenGL version with not-as-robust raycasting functionalities, I opted to do the "math" manually.
Namely,
- Compute the inverse matrix transformation to bring mesh vertices into viewport space
- Use the Cohen-Sutherland clipping algorithm to clip vertices outside
⭐ ⭐
Laplacian deformation is a constrained least squares optimization problem not covered in CS3242 but I learnt in CS5240 (Theoratical Foundations of Multimedia).
The optimization objective is to preserve the shape of the deformed mesh as much as possible, whilst being constrained by translations of certain vertices (in this case the purple dot you see the gif!). I implemented connected component checks as well to make this more performant.
(making the deer look slightly happier) (add some apparent motion to its legs)"Straightforward"! (lots of under the hood checks using the trist structure)
Also "straightforward".
The edge relaxation here aims to improve the quality of the mesh, through edge swapping.
Observe how "highly angled / obtuse" triangle's edges are swapped!
Instructions are included in the CLI. Several obj
files are also provided.
⭐ Specify the .obj
file path as an absolute file path.