# CSCI 375

## Computer Graphics

#### Description

Theory and implementation of computer graphics. Explores each stage of the graphics pipeline through topics such as mathematical representations of positions and transformations, graphics primitives, 3D modeling, cameras, clipping, lighting, texturing, animation, and rasterization. Students build a graphics engine by iteratively replacing library code with their own work. Offered periodically.

#### Prerequisites

C- or higher in CSCI 362; MATH 304.

#### Course Outcomes

1. Explain what happens in each stage of the graphics pipeline.
2. Explain how geometry can be transformed between model space, world space, camera space, clip space, normalized device space, and screen space.
3. Build matrices to achieve affine transformations and projections, and apply those matrices to position vectors.
4. Explain how a fragment's color can be assigned through lighting calculations, materials, and texturing.
5. Write shaders and client code that uses a graphics library such as OpenGL.

#### Major Topics Covered

A. Introduction

1.Introduction to Computer Graphics
2.History of Computer Graphics - ACM SIGGRAPH
3.Survey of Graphics Devices, Raster graphics
4.Local hardware and software systems

B. 2D Drawing Primitives

1.Points and Lines
2.Line-drawing Algorithms

a) Bresenham's method

3.Antialiasing
4.Circle generation
5.Graphics primitives

a) Polyline
b) Fill-area
c) Text
d) Polymaker

6.Line Styles
7.Color & Intensity
8.Area Filling

a) Scan Conversion algorithms
b) Boundary-fill
c) Flood-fill

C. Basic Vector and Matrix Algebra.

1.        Length of a vector

2. Normalization of a vector
3. Dot Product
4. Cross Product

2.        Matrix inverse, multiplication.

D. Two-Dimensional Transformations

1.Basic Transformations

a) Translation
b) Scaling
c) Rotation

2.Matrix Representation and Homogeneous Coordinates
3.Composite Transformations
4.Transformations Relative to a Fixed Point
5.Reflections

E. Virtual World Modeling Concepts

1.Modelers, geometries, viewports
2.3D Object creation and editing
3.Surface Normals
4.Materials

a) flat materials
b) two-sided materials
c) textured materials
d) mapping coordinates for textures

5.Surface Detail

a) polygons, triangles, faces, vertices
b) Texture Mapping
c) Bump Mapping

F. Three-Dimensional Representations

1.Polygon Representations on Surfaces
2.Curved Surfaces

a) Parametric Curves
b) Bezier Curves
c) Spline Curves

3.Surface and volume representations

G. Three-Dimensional Transformations

1.Basic Transformations

a) Translation
b) Scaling
c) Rotation

2.Matrix Representation and Homogeneous Coordinates
3.Composite Transformations
4.Transformations Relative to a Fixed Point
5.Reflection

6.World vs Local Coordinate systems

H. Three-Dimensional Viewing

1.Windows
2.Projections

a) Parallel
b) Perspective

3.Viewpoints, View Planes, View Volumes
4.3D Clipping
5.Normalization of Viewing operations
6.Visible line and hidden surface removal algorithms
7.Object space and image space algorithms.

I. Rendering and Lighting Concepts

1.Ray casting
2.Ray-tracing - Reflection and refraction

a) Flat
b) Gouraud
c) Phong

J. Virtual Reality

1.Virtual Environments
2.Object Oriented VR tools
3.Three-Dimensional graphics software tools

4. Physically based Modeling and Particle Systems
5.Virtual Reality equipment

data gloves,
virtual world modeling software

#### Sample Laboratory Projects

1. Sample Lab #1: (2 weeks)
1. Run the 3D Studio Tutorial and create the objects specified in the tutorial.
2. Build two 3D objects in 3D Studio (a 3d box and a 3d cone). Each of the six sides of the 3d box must be a different color. Put the cone is on top of the box.
3. Import the 3ds file into OpenGL and position it in front of the viewer.
4. Use the VR Graphics and the Windowing facilities in the MUOpenGL toolkit and use the 3D Studio modeler if the user types the following commands:
r -> rotates the cube and cone to the right (X axis).
l -> rotates the cube and cone to the left (X axis).
u -> rotates the cube and cone away from viewer in the Z axis.
d - > rotates the cube and cone towards viewer in the Z axis.
c -> continuously rotates the cube and cone to the right (X axis).
2. Sample Lab #2: (2 weeks) Modeling and MUOpenGL toolkit programming:
1. (A). Build a 3D model of the mobile robot (in the IML lab) in 3D Studio. Use the same colors (red, etc.) try to make it look fairly realistic without too much detail.
(B). Build a 3D model of a coke machine (make it look like a coke machine).
(C). Build a 3D model of Rubik's Cube (use Rubik cube colors, there is one in the IML lab).
2. Import the 3ds files into a MUOpenGL application and position it in the middle of the room.
3. Use the VR Graphics and the Windowing facilities in MUOpenGL toolkit and use the 3D Studio modeler user types a command:
• Your program should set a task for the mobile robot to move around the room (see fishy task in aquaman.c - see ghost movements....).
• When the user types in a different command the coke machine should act like the button was pressed and make a coke can come out of the shoot. Also, have the program make the noise it usually does when the can travels down the shoot and out the bottom.
• When the user types in a various rotate commands the Rubik's Cube should move the squares according to the particular rotation specified.
4. Sample Lab #3: (5 weeks)
Virtual Backhoe Training and Simulation system. Write a 'C' program(s) to simulate a virtual reality backhoe training and simulation system. Build on the work previously done by adding: Gravity, dump truck, other objects to pick up, software envelope for preventing backhoe smash ups, ground level constraints. Add 3D objects. Experiment with object-oriented animation primitives and library calls in the MUOpenGL toolkit.
5. Sample Lab #4: (5 weeks)
Virtual Reality Pool Shooting Game. Write a 'C++' program to create a virtual reality pool table game. The user is to be immersed in the pool game as the cue ball. The user aligns the shot and shoots him/herself (the cue ball) across the table. Hit a button and the user views the table from above so you can see the table, the default view is from the cue ball. Add 3D objects. Experiment with the physics calculations for bouncing off the rails and velocity vector computations of objects colliding in motion. Report your findings and conclusions.
6. Sample Lab #5: (3 weeks)
Add a lighting object to the current MUOpenGL toolkit. The light object should be able to move around the world and have oop functionality to change all of the lights parameters.
7. Sample Lab #6: (3 weeks)
Radiosity Program for the MUOpenGL toolkit - Write a 'C++' program(s) to produce a radiosity model file which will input a *.3ds object file and radiositize it as vertex colors.
8. Sample Lab #7: (4 weeks)
Virtual Reality Flight Simulation Code. Write a 'C' program(s) to use the Nintendo steering wheel in any virtual reality game or simulation. Build on the work previously done in the Nintendo GUN.c trigger code. Add 3D objects. Experiment with various control algorithms and report your findings.