CS 496 Computer Graphics
Project 1: Modeling
Identify some appropriate
geometry to be displayed using OpenGL. This requires proper initialization
of the OpenGL system, definition of the viewing environment, analysis of
the geometry into appropriate primitives and use of simple instancing transformations
to realize them, use of OpenGL functions to display the geometric primitives
to be displayed, use of hidden-surface display, and use of color as needed
for the geometry. Use the OpenGL idle
callback to create some motion in even this first project, as illustrated
in the barchart.c example.
The appropriate geometry
will depend on your choice of applicaton area. Here are some suggestions:
-
1a (Mathematics) Display
a surface defined by a function. This requires the creation of a
grid in the domain and corresponding points in 3-space in the surface,
displaying the triangles derived from the domain grid, and coloring the
surface in some way such as height. This function surface process
is described in the materials on math projects, and some example surfacess
are given there, except that these examples use lights and lighting instead
of simple color.
To look at the way color could be used, you can first find the largest
and smallest values of the function by scanning the values at each grid
node, and then any function value at any grid point can be scaled to a
value between 0 and 1 with a simple proportion. Once you have a value
z
between 0 and 1, you can define colors by using any path from one color
to another in the RGB cube. You could take, for example, a path from
red to blue, or you could take a much more dramatic path from (0,0,0) to
(1,1,1) from black to white in the cube. One such path is the
gray line where all three color components are equal, so for value
z
we could use the color (z,z,z).
Another path was outlined in class, where values between 0 and 1/3 lie
between black and one of the RGB primaries, values between 1/3 and 2/3
lie between the first primary and a color with two full primaries, and
values between 2/3 and 1 lie between the two-primary color and white.
-
1b (Chemistry) Read a
standard molecule description file and create a display of the molecule
with standard atom-coded colors. This requires the use of simple
transformations to place the atoms, using pre-written functions to read
molecular description files. The functions are online as molecules.h
(the header file for using the file reading functions) and readChemFiles.c
(functions to parse the PDB and MOL files).
This may be a little premature, because you probably need to use the translation
transformation to place individual atoms at the correct place in the molecular
model. However, the discussion on more advanced modeling includes
information on translations, so it should not be too difficult to read
ahead and accomplish this.
-
1c (Physics) Display
a rectangular bar divided into a grid, with some grid areas held at constant
hot or cold temperatures and with temperatures changing by a diffusion
process. The diffusion process sets the temperature of a grid area
at time T+1 as a convex sum of the temperatures of itself and surrounding
grid areas at time T. A convex sum is a weighted sum where the weights
are all non-negative and the sum of the weights is 1.
The bar itself can be seen as a grid with constant height, a simplified
version of the mathematical surface above, or you may display each grid
area with a height determined by the temperature as described in the materials
on physics projects. The process for choosing colors is similar to
the process for choosing colors in the math example above. The temperatures
will always lie between the hot and cold values in the problem. The
process for temperature diffusion is described in some detail in the materials
on physics projects, and we refer you there for more information.
-
1d (other) Find an area
of science where there is a function of two variables arising naturally
from the principles or theory of the science. The physics projects
writeup has an example of the functions of electrostatic potential, which
could serve as a good model. Graph the function using the processes
of problem 1a above.
Examples of similar programs
will be given in class to show what each can look like in operation.
Due date: February
29, 2000. Turn in your programs by e-mailing your source code to
your instructor and be prepared to demonstrate your running programs to
him in the laboratory. This project is worth 100 points and will
be graded on proper documentation, proper modeling, sound rendering, and
correct display. Proper coding techniques will not in themselves
be included in the grading, but if the instructor cannot understand your
code, it is much more likely that you will be asked to demonstrate your
project to a skeptical audience.