Programming Project #2: Skin

CSE 169: Computer Animation


Due: Monday, Feb 2, 11:59pm


Write a program that loads a character skin from a .skin file (described below) and attach it to a skeleton (loaded from a .skel file).


The skin should be rendered with shading using at least two different colored lights.


The program should allow some way to adjust DOF values in the skeleton. At a minimum, it could have keys for next/last DOF and increase/decrease value. Optionally, it could use widgets in a GUI to adjust the values or allow the user to interactively pick a joint and adjust it with the mouse.


The program should be able to load any .skin and .skel file given to it, and should accept .skin and .skel file name as a command line argument. For example:


project2  monster.skel


If no file name is given, it should default to ‘test.skel’ and ‘’.


As an option, it would be nice if the program allowed one to specify a .skel or a .skin by itself. If only a .skel is given, it could display just the skeleton in wireframe. If only a .skin is given, it could just draw the skin in its undeformed object space. This feature is not required.

Extra Credit

For 1 point, load a skin with texture information (details below).

For 2 points, load several morph files and add support for morphing (details below).

Skin File Description

The .skin file contains arrays of vertex data, an array of triangle data, and an array of binding matrices. For a sample .skin file, see and its corresponding .skel file tube.skel. For a very simple example, see


positions [numverts] {

    [x]  [y]  [z]



normals [numverts] {

    [x]  [y]  [z]



skinweights [numverts]

    [numattachments]  [joint0]  [weight0] … [jointN] [weightN]



triangles [numtriangles] {

    [vertex0]  [vertex1]  [vertex2]



bindings [numjoints]

    matrix {

        [ax]  [ay]  [az]

        [bx]  [by]  [bz]

        [cx]  [cy]  [cz]

        [dx]  [dy]  [dz]




Skin Sample

Here is a sample rendering of how should look:


This is from a more or less straight view with the x-axis pointing to the right, y-axis pointing up, and z-axis coming out of the screen towards the viewer.


For a more complex sample, try: wasp.skel and


For extra credit, you can load a version of a skin file with texture information and display it texture mapped. The textured files will have additional information in the skin file. After the normals array, will be an array of texture coordinates:


texcoords [numverts] {

    [texU]  [texV]




Also, before the actual triangles will be a material description:


material [name] {

            texture [texturename]



There will only be one material in the file. The ‘texturename’ will be the name of a bmp texture file.


For a sample: head_tex

Morph File Description

The .morph file is for the extra credit morphing feature. It represents a modified version of some base skin, and only contains the data that is different from the base. It has an array of positions and an array of normals. There is an index with each one that specified which vertex of the original skin is modified.


positions [numverts] {

    [index] [x]  [y]  [z]



normals [numverts] {

    [index] [x]  [y]  [z]




Note: The ‘numverts’ value will match between the two arrays, and so will the indexing.


For an example of a morphing character try: head

It is looking down the +x axis (instead of the –z as it should be). It has two morph targets- one raises the left cheek and the other raises the right eyebrow. Unfortunately, the character is just skinned to a single joint matrix. I hope to have some more interesting examples soon…


This project is worth 15 points:


5:         Skin attached to skeleton properly

4:         Lighting & normals working properly

4:         Interactive control working

2:         Reasonable use of object oriented design in code

15:       Total


Extra Credit:

1:         Render the skin with a texture map. A version of a .skin file with texture information and texture coordinates will be supplied


2:         Load several .morph files (to be provided) and add vertex blending. Add additional user controlled DOFs to blend the morph targets.


Here is some solution code for project 2. It requires the solution to project1 and the sample project0 code. The project 2 code replaces the tester.cpp and tester.h from project 1 and project 0.


The solution implements both extra credit features as well (morphing & texture mapping). It is set up to load a simple .rig file which contains all of the necessary info about the character’s data files.