
Skin Sample
Here is a sample rendering of how tube_smooth.skin 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 wasp.skin:
Programming Project Two: Skinning
Due Thursday, Jan 30th, before lecture.
Assignment
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 monster.skin
If no file name is given, it should default to 'wasp.skel' and 'wasp.skin'.
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.
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 tube_smooth.skin and its corresponding .skel file tube.skel. For a very simple example, see triangle.skin.
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]
}
...
}
Textures
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
You can use this code to read in a BMP image on both a Mac and a Windows machine. Just uncomment the #define MAC_OS line if you are compiling on a big-endian system such as a PowerPC Mac.
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.
Grading
This project is worth 15 points:
5: Skin attached to skeleton properly
5: Lighting & normals working properly
5: Interactive control working
15: Total
Extra Credit
+1: Extra credit for loading a skin with texture information (as described above).
+1: Extra credit for loading several morph files and add support for morphing (as described above).