Intro to Computer Graphics - Snowboarder Animation

Spring 2023

A link to the source code of this project is at the bottom of the page.
Snowboarder Animation.mp4

What is it?

This animation of a snowboarder traveling down a mountain is my final project for Professor Hanocka's Intro to Computer Graphics class. My submission attained a perfect score with additional extra credit, was ranked in the top 10 submissions for the class, and received a special prize from Pixar. 

While the animation itself is pretty decent, the truly impressive part of this project is the crazy set of computer graphics algorithms in the backend. I highly recommend you continue reading this page and check out my code to learn more!

What is the goal of this project?

For the final project for Intro to Computer Graphics, we were given an incredibly broad prompt: create a 10 second animation. 

However, along with this prompt came some additional stipulations.

First, our animation must be generated entirely through a Python script using the Blender Python API. 

Second, our animation's Python implementation must include at least 1 point worth of computer graphics algorithms. For reference, the assignment sheet for this project listed a number of graphics algorithms with varying point totals between 0.5 and 2 corresponding to the difficulty in implementation of each algorithm. If a student implements more than 1 point worth of algorithms, the extra points count towards extra credit. 

What did I do?

For this project, I opted to animate the motion of a snowboarder using 2 sets of algorithms.

First, I implemented a bunch of different splines to control the snowboarder's motion. These splines include B-Splines, Bezier Splines, Hermite Splines, Cardinal Splines, and Catmull-Rom Splines.

Second, I implemented Least Square Conformal Mapping (LSCM) to create UV maps for various meshes. Also, to help use this algorithm, I implemented a system based on Blender's "seams" system so users can manually modify their meshes to give them disc topology, which is necessary in order for LSCM to work. I used this algorithm to texture the snowboard with a fun picture of the Pixar lamp.

Splines - 0.5 points

Splines are piecewise parametric curves created from inputted control points. 

All of my code for the various splines I implemented can be found in the file interpolation.py in the GitHub repository linked at the bottom of this page.

Spline Properties

When classifying splines, the following properties are usually considered:

B-Splines

A B-Spline is a spline that generates an incredibly smooth curve loosely based on inputted control points, though without passing through these points.


B-Splines have the following properties:

Bezier Splines

Bezier Splines allow users to define curves via a mixture of interpolation and non-interpolation points. The curve will always pass through the interpolation points, while the curve will only receive guidance from the non-interpolation points. 

This mixture of interpolation and non-interpolation points gives users a ton of control over the curves generated by Bezier Splines, which is why these splines are the most popular splines in computer animation.

For this reason, I used Bezier Splines to guide the path of the snowboarder, as the snowboard needs to hit certain keyframe positions, but it also needs to travel along the mountain without passing through the ground. The increased control of Bezier Splines allowed me to guide the snowboarder around the mountain in a way that did not permit the snowboarder to pass through the floor.

In the backend, these splines are implemented via De Casteljau's algorithm, which is really cool! This algorithm uses chained linear interpolations between adjacent pairs of control points to guide the curve and influence it by an equal amount with each non-interpolation point.

Bezier Splines have the following properties:

Hermite Splines

Hermite Splines allow users to specify control positions and first derivatives to create curves that move into guided positions using guided directions.

In the backend, Hermite Splines are actually just degree 3 Bezier Splines, though with a different interface. Instead of directly specifying the non-interpolation points of Bezier Splines, those points are determined automatically based on the first derivatives.

Hermite Splines have the following properties:

Cardinal and Catmull-Rom Splines

Cardinal and Catmull-Rom Splines are Hermite Splines where the first derivatives are automatically determined from the positions of the previous and next control points, providing less control but easier usage. 

Cardinal Splines provide some additional control through a tension parameter that is constant throughout the entire curve.

Catmull-Rom Splines are Cardinal Splines with 0 tension when the control points are uniformly distributed along the parameter space (evenly spaced t-values). 

Because these splines allow you to create curves by only specifying control points, they are incredibly easy to use, which is why I opted to use them to move the camera, spin the camera, and spin the snowboarder in the animation.

Cardinal and Catmull-Rom Splines have the following properties:

Least Square Conformal Mapping (LSCM) - 2 points

LSCM is a common method of producing a UV map for a mesh. 

A UV map is a way of mapping the 3D vertices of a mesh to a 2D plane. Mapping vertices in this manner allows for a bunch of really useful things, such as texture mapping and bump mapping. 

This specific method of creating a UV map is special in that, as the name suggests, it produces conformal, or angle-preserving, maps. 

One caveat of LSCM is that it only works when the mesh is wholly connected and has a disc topology. If the mesh does not have a disc topology, the algorithm will map every point onto the same line. If the mesh is not connected (meaning there are different parts of the mesh that can be separated), the equation at the end of the algorithm will not have a solution. 

To help with the disc topology issue, I implemented Seams, which allow users to manually divide individual edges that are between 2 halfedges into 2 separate edges, one for each halfedge (in my implementation, meshes use the halfedge data structure). However, I only learned about the connectivity issue right before the project deadline, so I did not have time to implement a solution for that. Theoretically, however, users can manually split their meshes into connected disc segments and run this algorithm on each segment to create a UV map for any mesh, provided the user uses Seams to reduce each segment to a disc topology. In fact, that is the method I used to create the UV map for the snowboard. The top and bottom halves of the snowboard each called this algorithm separately as their own meshes and the resulting UV maps were spliced together horizontally to create a UV map for the entire snowboard.

LSCM Example

Snowboard Texture

Resources