csc 220 3d computer graphics fall 2003. graphics hardware u text mode – characters (2k bytes) u...

44
CSC 220 3D Computer Graphics Fall 2003

Upload: robert-griffith

Post on 11-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

CSC 220 3D Computer Graphics

Fall 2003

Page 2: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 3: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 4: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Graphics Software

BASIC is an exception API’s, or libraries

Borland Graphical Interface (BGI)

Graphical Kernel System (GKS)

OpenGL

Page 5: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Graphics File Formats GIF JPEG BMP TIFF Targa …

Page 6: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

The Graphics Pipeline Modeling – geometry of an object Viewing – how the object appears

hidden surfacessynthetic camera

Rendering – realism and morelightingshadingtexturesshadows

Page 7: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Modeling Techniques

Polygons (Triangles) Splines (NURBS) Constructive Solid Geometry (CSG) Fractals

Page 8: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate
Page 9: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Teddy – a Modeling Applet

Simple and quick For rough models instantly Spherical topology Operations

creationextrusioncuttingbending

Page 10: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 11: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Some Visual Cues

Visibility Shadows Reflections Refraction

Page 12: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Surface Algorithms Visibility

wireframe – ambiguity

hidden lines / surfaces Rendering techniques (2 of many)

z-buffer

ray tracing

Page 13: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Some Minimal Mathematics 3D coordinates – x,y,z as LHS Vectors – direction and magnitude Normal vector to a surface Culling back faces

Page 14: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 15: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 16: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Specifying an Image in SDL Objects

Simple shapesCSG objectsAdvanced shapes

Transformations Texture Camera Lighting

Page 17: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Simple Shapes

Spheres Boxes Cones Cylinders Planes

Page 18: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Constructive Solid Geometry

Union Intersection Difference Merge

Page 19: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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)

Page 20: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 21: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Lights in POV-Ray Point lights Spotlights

radiusfallofftightnessadaptivejitter

Cylinder lights (same parameters as spotlight)

Area lights Ambient lighting

Page 22: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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.

Page 23: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Ray Tracer Shading

Multiple reflections Transparency Refraction Shadows

Page 24: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 25: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 26: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 27: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 28: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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.

Page 29: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 30: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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.

Page 31: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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.

Page 32: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 33: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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!

Page 34: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

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

Page 35: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Viewing in Rhino Parallel or perspective projection

(each viewport) Panning Rotating Zooming

zoom dynamic zoom extents zoom window zoom selected

Page 36: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Drawing Lines

Line segments versus polylines

Coordinate systems

absolute cartesian 3,4

relative cartesian r3,4

absolute polar 5<60

relative polar r5<60

Page 37: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Modeling Aids Snap to grid Ortho Object Snaps Layers Constraints

distance constraint 5

angle constraint <60

Page 38: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Editing Objects Split and Trim Join and Explode Fillet Chamfer Transforms

scale

rotate

mirror

Page 39: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Rhino Geometry Points Curves Surfaces Polysurfaces – blended surfaces Solids – closed polysurfaces

Page 40: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Creating Curves Free-form

control points – Bezier curves

(for approximation)

interpolate points – spline curves

(for interpolation)

sketch Conic sections Polygons

Page 41: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Creating Surfaces From points From curves Extrusion Lofting Revolves Rail sweeps

Page 42: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Creating Solids Box Sphere Cylinder Tube Cone Ellipsoid Torus

Page 43: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Technical Side of Animation The Storyboard Keyframes Inbetween frames

for shape (morphing)

for motion Motion capture Physical modeling

Page 44: CSC 220 3D Computer Graphics Fall 2003. Graphics Hardware u Text Mode – Characters (2K bytes) u Graphics Modes – Pixels (millions of bytes) u x-y coordinate

Artistic Side of Animation Stretch and Squash Timing Anticipation Staging Slow In and Out Emotion