Download presentation
Presentation is loading. Please wait.
Published byArron Norton Modified over 9 years ago
1
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic Visualization Lab, University of Illinois at Chicago
2
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Coordinate Systems X Y Z X Y Z Left-handed Coordinate System (typical computer graphics Reference system – Blitz3D, DarkBASIC) Right-handed Coordinate System (conventional Cartesian reference system)
3
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Polygons, Meshes & Scan Conversion V2 V3 Raster Scan line V1
4
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Transformations Transformation occurs about the origin of the coordinate system’s axis TranslateScale Rotate
5
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Order of Transformations Make a Difference Translate along X 1; Rotate about Z 45 Rotate about Z 45; Translate along X 1 Box centered at origin Evaluation order in Blitz3D, DarkBASIC’s position, scale, orientation commands: Scale, Rotate, Translate
6
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Hierarchy of Coordinate Systems Also called: –Scene graphs –Parent and Child Entities in Blitz3D –Called Skeletons in DarkBASIC because it is usually used to represent people (arms, legs, body). Local coordinate system
7
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) The Camera Parallel Projection Perspective Projection
8
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) The Camera Projection Plane View Volume Near Clipping Plane Far Clipping Plane
9
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Lighting Ambient – basic, even illumination of all objects in a scene Directional – all light rays are in parallel in 1 direction - like the sun Point – all light rays emanate from a central point in all directions – like a light bulb Spot – point light with a limited cone and a fall-off in intensity – like a flashlight Cone angle Penumbra angle (light starts to drop off to zero here)
10
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Diffuse Reflection (Lambertian Lighting Model) The greater the angle between the normal and the vector from the point to the light source, the less light is reflected. Most light is reflected when the angle is 0 degrees, none is reflected at 90 degrees.
11
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Specular Reflection (Phong Lighting Model) Maximum specular reflectance occurs when the viewpoint is along the path of the perfectly reflected ray (when alpha is zero). Specular reflectance falls off quickly as alpha increases. Falloff approximated by cos n (alpha). n varies from 1 to several hundred, depending on the material being modelled. n=1 provides broad, gentle falloff Higher values simulate sharp, focused highlight. For perfect reflector, n would be infinite.
12
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Fall off in Phong Shading Small n Large n
13
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Approximating Curved Surfaces with Flat Polygons Flat Shading – each polygon face has a normal that is used to perform lighting calculations.
14
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Gouraud Shading Compute vertex normals by averaging face normals. Compute intensity at each vertex. Interpolate the intensity along the edges of the polygon. I1 I2 I1,2I1,3 I3 I1,2,3,4 Raster Scan line
15
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Phong Shading Interpolate the Normals between the end points of the scan line rather than just the intensity. Used with Phong lighting model to produce specular highlights. N1,2 N1,3 N1 N2 N1,2N1,3 N3 N1,2,3,4 Raster Scan line
16
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Texture Mapping Apply picture to a polygon surface to add realism without explicitly creating geometry. u v
17
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Texture Maps Used in Tank Game
18
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Billboarding Billboards Real
19
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Backface Culling & Flipping Surface Normals
20
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Normal Mapping Regular texture mapTexture map + normal map Modify normals on a per-pixel basis using a Normal Map The map is an R,G,B map where the 3 components represent the direction of the normal vector relative to the tangent of the polygon’s surface
21
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Normal Mapping In modern games, normal maps are computed for high polygon scenes and then mapped onto low polygon models giving them incredible levels of detail See 1st segment of UnReal Video on Normal MappingSee 1st segment of UnReal Video
22
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Bump Mapping Predecessor to Normal Mapping where a greyscale texture is used as a height field to modify the shading normal on the surface of a polygon (on a per pixel basis) Creates very similar effect as Normal Mapping Polygon surface Height field Perturbed normals
23
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Weakness of Normal/Bump Mapping If you look at the polygon on its side, it will still look flat. Answer: Use Displacement Mapping to perturb the actual geometry of the mesh Height field is used to displace the geometry of the mesh along its normal See UnReal video on displacement map (right after Normal Map) Bump Displacement
24
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Double Buffering, Drawing Order, Z Buffering Front Buffer Back Buffer Image is drawn to the back buffer while the front buffer is displayed to the viewer. Swapping is usually done during vertical blank of the monitor (50Hz). Most PCs tend to turn this synch off resulting in flickering of graphics.
25
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Depth Sorting of Polygons PS1 did not have Z Buffering Polygons had to be sorted back-to-front to draw them in the right order. Z Buffer ~ 16-32bits/pixel. Buffer that stores depth information on a per pixel basis. Used to determine which pixel is in front of the other. Small Z values are in front. Avoids having to sort polygons in Z when rasterizing. 2 3 4 8
26
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) Transparency & the Effect of Drawing Order 123 Drawing order Alpha blending occurs Viewpoint
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.