Study the 5 OpenGl programs:
3d.c,
light.c,
unproject.c,
spinner.htm,
viewer.htm,
and texture.htm
See section below on how to get and compile
3d.c
Write an openGL program that lets the user view and rotate a cube
Define a 3D array of voxels (in [0..N]3). Initially make
N=20
Assign IN/OUT values to grid samples randomly (20% chances to be
IN)
Set up view and transform so that the whole set is nicely framed
Render an axis aligned voxel (unit cube) centered at each IN node
Make each cube shrink by 10% to show the interstice between voxels
Let the user rotate the whole model interactively
(keep projection of the y-axis up-vector vertical
on the screen)
Add clear and detailed comments to your code
(comment most instructions, except repetitions,
to show that you understand what they do)
Include course number, date, team name, and authors in the header
of the source file
Create web page with:
- Team name
- Names and emails of team members
- Brief description of what the program does and how to compile and use it
- Link to the source code and to any auxiliary file needed (.h, Make…)
Email url to instructor and
TA (cc all members of the team so that we get all the names and emails)
Use file format suggested
below for specifying rectilinear CSG models
(Boolean combinations of axis-aligned boxes):
%N # number of voxels in each dimension
A=(Sx,Sy,Sz,Ex,Ey,Ez) # Si and Ei integer coordinates of diagonal end-pts
C=A-B # Boolean difference
D=A*C # Boolean intersection
!D # show D
For simplicity, assume that
all primitive names (A,B,...) are integers (1,2...)
Create simple and more complex samples of such CSG models
Implement a file reader and representation of CSG
I suggest an array of primitives each defined
by 6 coordinates and an array of structs for the CSG tree
Each struct contains the operator (primitive,
union, difference, intersection, motion) and its arguments (integers)
Implement CSG evaluator
Combine with the viewer of Part A
OPTIONAL (extra credit): add syntax and code for transformations
and allow replications
B=A@(x,y,z) # where (x,y,z) defines a translation vector to be applied to A
Design a few pieces of
furniture and produce images
Create web page with description, images, links to data files and
to source (commented)
(Include Pseudocode for testing voxel agains CSG
tree)
Add link to it from your
project page
Write code to compute the triangles for an isosuface of the voxel models produced in project 1A ans 1B
Display the edges (called
sticks) joining adjacent voxel centers with different classification.
Display small balls (called vertices) around the voxel centers
and paint them red if the voxel is in and green otherwise
Display a small ball at the midpoint of each stick
For each cube (having 8 voxel centers as corners) compute the border
edges (use parity of x+y+z to disambiguate)
Make sure that the border edges are properly oriented
Link the border edges into
loops
Triangulate the loops, making sure that the triangles are properly
oriented
Make two series of images: one with the vertices in their original
position and one in their adjusted position
In all pictures show the sticks, their color-coded endpoints (voxel
centers) and the vertices (as small balls)
Use the same viewpoint and the same model in all pictures
Select a model and a viewpoint
showing some interesting cases (ambiguous faces)
In each series show sticks with ends, and vertices only in one picture
Then add the edges in the next picture, then add the triangles (flat
shaded).
Create a new web page showing these images and add some brief explanations
Include a pointer to the source code with comments
Add a link to that page from your project page
Extra Credit Optinon:
Adjust the vertices along their sticks to smoothen the iso-surface
Make two series of images: one with the vertices in their original
position and one in their adjusted position
Make an animation showing a smooth interpolation between the original
and the adjusted mesh (geomorph)
Capture the animation at low resolution add a link to it from your
web page
(Suggestions for capturing a video from a window are provided on the
class web pages)
Write code to build the Corner Table for the iso-surfaces generated in phase C
Use sorting to accelerate the construction of the O table
Report timings as a function
of the resolution of the voxel space
Implement the Corner Table operators
Use them to compute vertex normals
Render the mesh with smooth
shading
Compute the shells (edge-connected
components of the mesh) and color code them each with a different color.
To build a shell, pick a new color (say red) and an unpainted triangle
and paint it red. Then, using the mesh traversal procedure explained in class,
walk from the red triangle to its neighbors recursively using the c.o operator.
For each shell compute its genus (i.e. the number of holes).
Output the statistics: list
the shells and for each shell provide its color, genus, number of triangles
and number of vertices
Do this for 3 iso-surfaces:
- one random,
- one from CSG having two zero-genus shells (one inside the other like a ball with a spherical cavity inside)
- one having a shell with genus 2
Create a new web page showing these resulting images plus statistics
Include a pointer to the
source code with comments
Add a link to that page from your project page