# CS 184: COMPUTER GRAPHICS

PREVIOUS < - - - - > CS 184 HOME < - - - - > CURRENT < - - - - > NEXT

# Lecture #3 -- Tu: 9/7, 2004.

### Crucial Items from Last Lecture

• Drawing on a raster device (turn on selected pixels).
• Suitable line-drawing abstractions (closest pixel centers, or pixels whose centers are covered by a "fat" line)..
• How to save a computer graphics object (save relevant info only: coordinates, connectivity, color ... ==> need an "interchange format").

## SLIDE and TCL

Since polygon2 is created from polygon1 by a deformation,
both polygons have contours with the same number of points;
so we can establish a simple one-to-one mapping between these points.
The morphing parameter defines an intermediate polygon by interpolating between the positions of corresponding points.
(For a good, pleasing, smooth morph, do not move vertices wildly across opposite polygon edges).

## Creating a Model World: Hierarchical Description

Now we want to build scenes with more than just one polygon!
How should we "describe" a complex world model in the computer ?
for instance: Boeing 747: ~ 4 000 000 identifyable parts.
Use hierarchically nested objects with relative transformations.
Benefits: Managing complexity, abstraction, structure, re-use of objects, easy searching and editing...

### Hierarchical Scene Composition and Description

Example #1: Houses on Hill
• Scene Tree;
• SLIDE description
• Importance of transformations
(later we will see that there are elegant and powerful mechanisms)

## Quick Overview of Rendering Process

Now that we have a scene, -- how do we a get picture of it?
[Ch 7.1]
In this class we mostly follow an object-oriented approach !
Each object (polygon) is individually modeled, transformed, processed, and rendered.
World to screen transforms - Overview
Watch out -- in this class we take a more generic view than the text book which focuses on OpenGL.
Similarly, SLIDE has some subtle differences compared to OpenGL; e.g., it is not a "state machine."

The Various Coordinate Systems:
This is valid in some form for all rendering environments.

Master Space, Model Space, Symbol Space:
Used to define hand-designed or procedurally-generated (master) objects or "symbols".
There may be a hierachy of such model spaces,
but at the lowest level (at the "leaves"), the geometry  is "flat" (non-hiererchical).

World Space, Scene Space:
Used to composite the overall scene.
Hierarchy of (instantiated, transformed) groups and objects.
(Watch out in what sequence the transformations are applied !)

Rendering Space, Eye Space, Camera Space:
Defines from where we want to view the scene, and what lies outside the viewing angle.
We form a new coordinate system with its origin in the eye (or in the camera lens),
and with its z-axis in the looking direction; we also form an "up" direction for the display.
The projection screen (retina, film) is perpendicular to that direction, and lies at some distance;
it contains a rectangle (the "window") that defines what part of the overall scene will be rendered.
From the eye we do a point projection ( perspective projection )onto the screen;
alternatively, we can do a parallel projection from the direction of the eye.
In either case, we may clip away stuff that is too close or too far away.

Image Space:
This is the 2D space of the projection screen.
Often the scene hierarchy has been lost; it is now just a flat set of lines, polygons, etc.
The drawing primitives may have been (re-)arranged into (display) segments;
these may be grouped for similar treatment (color, transparency, visibility, spatial location).
This set may then be clipped by the "window" (rectangular area in the projection plane).

Normalized Device Coordinates:
Fit everything into a unit square for easy manipulation and mapping onto the screen
or into rectangular viewports (= `window' to the laymen) on the screen.
This is achieved through a simple coordinate transformation of all elements inside the "window."
This gives us device independence !

Screen Space:
Pixels or x,y addresses of the actual display device.
Dots, lines, filled areas, etc ... are expressed typically in integers > 0.
Y-axis may be upside down (counting pixel rows downward).

Much more on all this in the next couple of weeks ...

## Preview: Modeling and Object Representations in 3D

If we want to display, say,  a `sausage' we first need to discribe it to the computer.
How ??
-- There is much more variety in 3D than there is in 2D
[Ch 4.2]

### Some Basic Object Representation Formats:

Voxels and Octree:
Concept: sample space regularly; determine: inside/outside sausage?
"Turn on" voxels.  Efficient encoding in a quadtree or an octree.
[Ch 9.10.4]

CSG and Boolean set operations:
Sausage = bent cylinder plus spherical end-caps.
Show 2D composite.
[Ch 9.10.1]

B-rep and winged-edge data structure:
Tessallate surface; describe polygons via vertices, edges.
[Ch 4.2]

Procedural modeling:
Use a program to generate the sausage: Sweep a circle through space along a curve.
Start small for front-cap, keep constant through main part of sausage, taper down to zero for end cap.
("Procedural Generation of Parameterized Parts" preferable to: "Primitive Instancing" )
[Ch 11.1]

Instantiation Hierarchy:
Ways to build complicated scenes in an organized manner.
This is a general principle that can combine parts made with any of the above methods.
Reuse such parts several time by making (possibly transformed) copies of them.
[Ch 9.2]

(more on that later)

Study: 2ndEd: Ch 3.6-3.7, Ch 4.2, Ch 4.4.5, Ch 7.0-7.1, Ch 8.0-8.2,
Study: 3rdEd: Ch 3.6-3.7, Ch 4.2, Ch 4.4.5, Ch 8.0-8.2, Ch 9.0-9.2,

Skim:  2ndEd: Ch 4, Ch 8, Ch 11.1,
Skim:  3rdEd: Ch 4, Ch 9, Ch 11.1,

## New Homework Assignment:

ASG#2:  "Car into Plane" -- Editing and Morphing

PREVIOUS < - - - - > CS 184 HOME < - - - - > CURRENT < - - - - > NEXT
Page Editor: Carlo H. Séquin