Ice Drawing Program

CSC 471 WINTER 2004

Dat Phan

Download: Ice4.zip

Overview

Draw growing crystals or chunks of ice on a 3d canvas.

Technical Notes

I was able to implement most of my features such as object growth, transparency, and recursively drawn crystals. I was not able to implement 3d picking to allow for older objects to change with new objects or with user input. Also I did not predict my crystal drawing algorithm would run so slow.

User Interface:
I had to do a bunch of math to get the user mouse inputs from 2d pixel coordinates to map to the 3d world coordinates with perspective. The formula I came up with works well even though it is just an approximation.

Growth:
To mimic growth I put 2 floats in each ice node object, one for max scale and one current scale. For each redraw I increment the current scale a fraction of the difference between the max scale and the current scale. This gives the objects a nice natural growth animation.

Crystals:
To make the crystals seem like they are sprouting new branches I had to give each set of branches their own scale factor.

Because they must be recalculated each time they are drawn, the crystals hurt performance drastically. I tried using OpenGL display lists for each crystal, but that did not improve performance.

Future plans

I would really like to have the crystals draw faster. It really bothers me how slow they are.

User Guide

Mouse Usage:

- Left click with the mouse to draw single objects. The longer the mouse button is held down the larger objects get.
- Click and drag to draw lines of objects.
- Right click to access the menu

Available Options:

- Draw Crystals or Ice Chunks (default)
- Choose the color of the Ice. The available colors are White (default), Blue, Green, Red or Purple.
- Enable or Disable Transparency
- Toggle texture mapping for the drawing surface
- Rotate the scene
- Change the complexity of the crystals. Choose between 1d, 2d (default), and 3d
- Change the fractal depth. Choose between 0, 1 (default) or 2
- Undo last object drawn or clear entire scene

Keyboard Commands:

Y - Draw Crystals
U - Draw Chunks
O - Make objects Opaque
T - Make objects Transparent
S - Toggle surface texture
R - Enable rotate mode
Z - Undo Last Object
C - Clear Scene
Q - Exit Program

Screenshots

Here is a scene I whipped up in a few seconds. To add variety to the ice chunks I used a random number generator to give each chunk a tilt factor. I tweaked the cloud texture given in class to make the ice textures.


Here's a shot showing off the transparency. Too bad the program runs slow with transparency enabled.


The crystals took a lot of tweaking after I got the basic code down.


These are the different complexities of the crystals.


These shots show a crystal with different fractal depths.