CSC 220 3D Computer Graphics
Fall 2003
Graphics Hardware
Text Mode – Characters (2K bytes) Graphics Modes – Pixels (millions of bytes) x-y coordinate system
Raster Scan with Frame Buffer (aliasing) Vector Scan with Display List
Color for Computer Graphics
Red, Green, Blue phosphors and shadow mask
VGA – 640 x 480 with 16 colors VGA – 320 x 200 with 256 colors, using the
Color LookUp Table (CLUT) – 8 bits / pixel is 256 colors at one time, but 262,144 colors in palette SVGA with True Color – 800 x 600 (or more), using 24 bits / pixel – millions of colors simultaneously
Graphics Software
BASIC is an exception API’s, or libraries
Borland Graphical Interface (BGI)
Graphical Kernel System (GKS)
OpenGL
…
Graphics File Formats GIF JPEG BMP TIFF Targa …
The Graphics Pipeline Modeling – geometry of an object Viewing – how the object appears
hidden surfacessynthetic camera
Rendering – realism and morelightingshadingtexturesshadows
Modeling Techniques
Polygons (Triangles) Splines (NURBS) Constructive Solid Geometry (CSG) Fractals
…
Teddy – a Modeling Applet
Simple and quick For rough models instantly Spherical topology Operations
creationextrusioncuttingbending
TERA A tool for visual literacy Can display 500,000 combinations of
images rendered by various methods Can be used in two ways
explore rendering effects
self-test rendering effects Contains POV-Ray files also
Some Visual Cues
Visibility Shadows Reflections Refraction
Surface Algorithms Visibility
wireframe – ambiguity
hidden lines / surfaces Rendering techniques (2 of many)
z-buffer
ray tracing
Some Minimal Mathematics 3D coordinates – x,y,z as LHS Vectors – direction and magnitude Normal vector to a surface Culling back faces
The Z-buffer Method Along with frame buffer have a z-buffer:
Frame buffer holds color value for the pixel
Z-buffer holds z value for the pixel location Scan each surface in succession. If z value
for this location on this surface is less than value in z-buffer, replace color in frame buffer and update value in z-buffer
Most common rendering method, often with special hardware
POV-Ray
No modeling, uses Scene Description Language (SDL)
Does viewing and rendering No books in print, but excellent on-line
documentation Exercises from TERA text
render gold.pov, p.9
render room.pov, p.20
revise camera orientation of room, pp.21,22
Specifying an Image in SDL Objects
Simple shapesCSG objectsAdvanced shapes
Transformations Texture Camera Lighting
Simple Shapes
Spheres Boxes Cones Cylinders Planes
Constructive Solid Geometry
Union Intersection Difference Merge
Transformation of Coordinates Affine transformations
translation scaling rotation
Composition of affine transformations Properties of affine transformations
straight lines stay straightparallel lines stay parallelangles do NOT stay fixed, except for rigid
transformations (no scaling)
Z-Buffer Shading Constant Shading – color computed once for
entire object Faceted Shading – color computed once for each
polygon Gouraud Shading – color computed using vertex
normal, then double interpolation of color values in the polygon
Phong Shading – double interpolation of vertex normals, then color value computed for each interpolated vector value in the polygon
Lights in POV-Ray Point lights Spotlights
radiusfallofftightnessadaptivejitter
Cylinder lights (same parameters as spotlight)
Area lights Ambient lighting
Reflected Light When light strikes a surface, some colors are
absorbed, and we see the colors that are reflected. We deal with three types of reflections:
ambient reflected light
diffuse reflected light
specular reflected light (Phong illumination) Computing the reflected values requires that
vectors must be multiplied.
Ray Tracer Shading
Multiple reflections Transparency Refraction Shadows
2D Texture Mapping Map Types
planar – normal parallel to X, Y, or Z cylindrical – rotation around X, Y, or Z spherical – rotation around X, Y, or Z box – normal parallel to X, Y, or Z
Problems poles distortion aliasing
Bilateral symmetry and planar maps
3D Texture Mapping
Procedural – texture is function f(x,y,z) Common textures are stripes, rings, ramps Noise for realistic effects
amplitude frequency use of higher order terms eccentricity, tilt, and twist
Texture functions in POV-Ray for glass, metal, stone, and wood
Viewing – the Synthetic Camera
World Coordinates (WC) – x,y,z
r is location of camera in WC The View Plane – U,V,N
N is where camera is looking
V is up direction, orthogonal to N
U is 3rd axis, orthogonal to both N and V
Light and its Perception In describing the effects of light we must take
into account both physics and physiology. The wavelength of visible light varies from 400
nanometers (violet) to 700 nanometers (red). In describing the quality of light, we need three
parameters: hue – the dominant wavelength intensity (physics) or brightness (physiology) saturation – the purity of the hue
The Human Eye The eye has rods that are very sensitive to light
versus dark (about 1 photon), and cones that are less sensitive to level (about 5 photons) but can distinguish colors.
There are cones sensitive to blue, to green, and to red. They are all in the fovea (1/4 mm), and are the basis of the tristimulus theory of vision.
Light which is a mixture of red and green looks just as yellow as does pure yellow light! The human visual system cannot detect overtones and harmonics as does the human auditory system.
The Color Cubes The primaries for additive (emitted) color in
computer graphics are red, green, and blue, yielding the RGB color cube. red + green = yellow red + blue = magenta green + blue = cyan
The primaries for subtractive (reflected) color are cyan, magenta, and yellow, yielding the CMY color cube. cyan ink absorbs red magenta ink absorbs green yellow ink absorbs blue
The HSV Color System It is difficult to predict what a given mixture of
RGB levels will look like. For such a purpose, it is easier to use the HSV
coordinate system based upon Hue, Saturation, and Value.
This maps to a cone or a six-sided pyramid: Hue is the angular location on the side wall Saturation is the relative distance from the
center line to the color point (purity) Value is the height in the inverted cone
These can easily be thought of in more natural terms such as tints, shades, and tones.
HalftoningWhen there are a limited number of color levels
available in the output, we can trade spatial resolution for color resolution. Thus, there may be just 2 color levels (e.g. black or white). Take ‘super-pixels’ of size 2x2 or 3x3. Within a 2x2 block, there are 4 individual pixels that may or not be lit, for 5 levels of aggregate intensity in that super-pixel.
To the eye, the increased color gradation is well worth the loss in spatial resolution.
Some Advanced Shapes Blobs for lumpy objects Splines to fit to control points
approximation – Bezier curves
interpolation – many types of splines
piecewise polynomial sections (cubics)
smoothness, or continuity NURBS – Non Uniform Rational B Splines
NURBS Non-uniform rational B-splines
non-uniform – spacing of control points rational – a quotient (ratio) of polynomials also knots where kinks are desired
NURBS are good for modeling curves Just as important properties are maintained with affine transformations, so are NURBS
maintained under projective transformations – so only control points need be transformed.
NURBS can model conic sections exactly!
The Rhino Interface Rhino is a modeling tool – has primitive
shading and rendering capability 3 Orthographic Viewports
top, front, right views are default
bottom, back, left views are also possible 1 Perspective Viewport 2 Toolbars, with flyouts
Viewing in Rhino Parallel or perspective projection
(each viewport) Panning Rotating Zooming
zoom dynamic zoom extents zoom window zoom selected
Drawing Lines
Line segments versus polylines
Coordinate systems
absolute cartesian 3,4
relative cartesian r3,4
absolute polar 5<60
relative polar r5<60
Modeling Aids Snap to grid Ortho Object Snaps Layers Constraints
distance constraint 5
angle constraint <60
Editing Objects Split and Trim Join and Explode Fillet Chamfer Transforms
scale
rotate
mirror
Rhino Geometry Points Curves Surfaces Polysurfaces – blended surfaces Solids – closed polysurfaces
Creating Curves Free-form
control points – Bezier curves
(for approximation)
interpolate points – spline curves
(for interpolation)
sketch Conic sections Polygons
Creating Surfaces From points From curves Extrusion Lofting Revolves Rail sweeps
Creating Solids Box Sphere Cylinder Tube Cone Ellipsoid Torus
Technical Side of Animation The Storyboard Keyframes Inbetween frames
for shape (morphing)
for motion Motion capture Physical modeling
Artistic Side of Animation Stretch and Squash Timing Anticipation Staging Slow In and Out Emotion