Matt's Source Code Portal

About Links Problems Contact

This site serves as a web presence for most of the code I've ever written that I think other people might find useful. Most of my interest lies in graphics programming, which is the focus of most of my code. I also enjoy data compression, artifical intelligence, solid or fluid simulation, and optimization. However I have little experience in these areas so my code would not be very useful to others. Wherever possible, I try and give complete examples for every class or structure I write. Unfortunately lots of the stuff here I wrote in my high school or early college years and the coding style isn't very good.

Publications

Design of tangent vector fields   Tangent vector fields are an essential ingredient in controlling surface appearance for applications ranging from anisotropic shading to texture synthesis and non-photorealistic rendering. To achieve a desired effect one is typically interested in smoothly varying fields that satisfy a sparse set of user-provided constraints. Using tools from Discrete Exterior Calculus, we present a simple and efficient algorithm for designing such fields over arbitrary triangle meshes. By representing the field as scalars over mesh edges (i.e., discrete 1-forms), we obtain an intrinsic, coordinatefree formulation in which field smoothness is enforced through discrete Laplace operators. Unlike previous methods, such a formulation leads to a linear system whose sparsity permits efficient pre-factorization. Constraints are incorporated through weighted least squares and can be updated rapidly enough to enable interactive design, as we demonstrate in the context of anisotropic texture synthesis. Published in SIGGRAPH 2007. Video

Topics

Below is a list of important topics I feel like talking about, or areas where I think existing online descriptions are not very complete.

Meshes   A mesh structure is the backbone of most graphics applications, and actions like iterating over all the edges in a mesh is necessary for many algorithms.

Cloth   Simulating cloth, or any other thin-shell material, is a rich topic in which a wide variety of concepts come together.

Subdivision   Subdivision is a powerful algorithm for constructing smooth surfaces.

Common Code

This section contains code and documentation for my set of common graphics structures, graphics API wrappers, mathematical objects, etc.

Independent Structures   These are a series of independent source files. All of these are used in the BaseCode, but could easily be used independently of it. The included files are a safe array and linked list class, a 3D and 4D vector structure, a matrix structure, and a non-linear optimizer (using conjugate gradient.)

My Graphics BaseCode   This is the code that underlies all of my graphics projects. Rather than using a specific API (OpenGL or DirectX) I wrote vector, matrix, camera, mesh, software rendering, etc. structures myself. Each project can then choose whether to render in OpenGL, DirectX, or software, with only changing one line of code. Regardless of the API chosen, the underlying representation of the data remains the same. The base code is quite extensive and has many structures (such as extensive edge-based and edgeless mesh structures) that may be useful even if the BaseCode itself is not.

Using The BaseCode   Examples of using various aspects of the BaseCode. None of these examples are very complicated or involve much code, but demonstrate features in the code that may otherwise be hard to find or use. Examples include using the mesh shape functions, multiple cameras, textures, using multiple MainControl classes, mesh manipulation, capturing the screen pixel data, video capture, X File rendering, and using videos as textures. Wherever possible, support exists for software, OpenGL, and DirectX rendering; however some things I have not yet written (such as textures in software) and some things I do not know how to do (such as video textures in OpenGL.) Also contains a few videos of some other projects.

My Projects

These are projects I have for the most part finished. They will all expect the folder EngineInterface to be in their include directory:
x EngineInterface.zip

They also only include project files compatible with MSVC++ .NET 2003. However, I have gotten them to compiled them in g++, although DirectX compiles only with Microsoft's compiler. The executable file is also included in each zip, but is never any different than what the source code would compile. However, due to how the DirectX build works it will need the specific version of the d3d9 dll I compiled it with, namely
xd3dx9_24.dll

All these projects use the same camera movement, based off classic first person-shooter controls. The specifics of this can be found here.

xIsosurface Rendering With Marching Cubes   Given an arbitrary function f(x, y, z), there is a well defined surface where f(x, y, z) = c for every real number c. Often you might want to represent this surface as a series of triangles; a simple algorithm to accomplish this is called marching cubes. This project demonstrates marching cubes in action on a variety of implicit functions. A good description of the marching cubes algorithm can be found here. The meshes generated by this algorithm are not very uniform; see here for an algorithm to produce clean meshes from marching cubes output.

xVisual Rubik's Cube Solver   Rubik's Cubes are amusing puzzles, and unknown to many, a vast array of straight-forward algorithms exist to solve them, which consist of a sufficently small number of steps that a human can do it. This program renders a 3D Rubik's cube, and you can scramble the cube and have the computer solve it. It has a wide array of algorithms programmed in (the layer method, corner's first, instant 3rd layer, etc.) but this program only uses the simple layer method.

Texture Synthesis (Pictures, Code)   Output from my implementation of two texture synthesis algorithms on a variety of input textures. The source is attached, but was rushed into a single week so unorganized and uncommented. See Links for more information on texture synthesis.

xBone Modelling Program   Movies and games often animate meshes by imposing a bone structure to some base configuration, and then defining new, deformed, mesh configurations as rotations of this underlying bone structure and inital mesh. This is one of my attempts to create such a bone modeller and animator myself. It's not very powerful for large projects, but can quickly model complex human bone movements (like fingers) which I needed when I was working on using my cloth simulator to model a human swinging a cloth around themselves.

xCloth Simulator   There is a lot to realistically modelling a piece of falling cloth. This code does a decent job in a reasonable amount of time, mostly by using the trick of subdivisional surfaces to get away with small a small number of input nodes and still achieve pretty results. Although this code only models a piece of cloth fixed at one vertex draping around a nearby sphere, it can easily interact with arbitrary, dynamic geometry. For a complete description of this simulator, see the topics section above.

xWater Surface Simulation   A simple trick for approximately simulating the surface of a large body of water. Not very fancy (or very much code) but still functional. You'll find lots of games (Baldur's Gate: Dark Alliance, God of War, Devil May Cry III, etc.) all use some version of this trick because it's very cheap processor-wise. To look correct, the coloring needs to use a pixel shader so the lighting is per-pixel rather than per-vertex. While I have such a shader it masks the underlying function of the algorithm.

xPresentation   Everyone has already seen every slide effect transition ever used in PowerPoint. 3D effects, or complicated 2D effects, look very impressive and are a refreshing break from the same Powerpoint boredom. This is a presentation I did a while ago for a company; it combines transitions from Rubik's Cubes to fluid simulations plus complex animations within a slide and can be amusing to watch. The presentation itself will make no sense, as I had to replace or edit every slide, but all the slide textures can be easily changed in the Data folder.

Comming Soon

A* Pathfinding   This is a simple program I wrote to experiment with the speed of the A* pathfinding algorithm. It lets you order around hundreds of little car units on an arbitrary grid, and see them all try and find the best path, deal with colliding into each other, and I was happy to find that A* is very, very fast.


last update: Dec 22nd 2005     © 2005 by Matthew Fisher