Download presentation
Presentation is loading. Please wait.
1
Coordinate Systems X Y Z (conventional Cartesian reference system) X Y Z
2
Transformations 4 Transformation occurs about the origin of the coordinate system’s axis Translate Scale Rotate
3
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
4
Hierarchy of Coordinate Systems 4 Also called: –Scene graphs –Tree structures Local coordinate system
5
The Camera Parallel Projection Perspective Projection
6
The Camera Projection Plane View Volume Near Clipping Plane Far Clipping Plane
7
Rendering Pipeline Hardware ModellingTransformVisibility Illumination + Shading Color Perception, Interaction Texture/ Realism
8
Polygons, Meshes & Scan Conversion V2 V3 Raster Scan line V1
9
Approximating Curved Surfaces with Flat Polygons Flat Shading – each polygon face has a normal that is used to perform lighting calculations.
10
Gouraud Shading 4 Compute vertex normals by averaging face normals. 4 Compute intensity at each vertex. I1 I2 I1,2I1,3 I3 I1,2,3,4 Raster Scan line
11
Illumination / Shading 4 Distinction between illumination and shading models –illumination - calculate intensity at a point on surface –shading - uses calculated intensities to shade polygons (uses illumination models) 4 we’ll review the important models
12
Illumination / Shading 4 We’ll talk more about concepts that lead to realism: –global illumination: ray tracing + radiosity –“special effects/tricks”: shadows, texture maps, bump maps, anti- aliasing, transparency, reflection maps, refraction
13
Local Illumination 4 Local vs. global illumination models –local (typically) - how is one point of the scene illuminated directly by the light source is light source only source of illumination? Simple models lump the rest into a single ambient term do not account for reflections within the environment
14
Local Illumination 4 Local vs. global illumination models –global - illuminates the whole scene typically makes use of local illumination model incorporates inter-reflectance of objects
15
Lighting 4 Ambient – basic, even illumination of all objects in a scene 4 Directional – all light rays are in parallel in 1 direction - like the sun 4 Point – all light rays emanate from a central point in all directions – like a light bulb 4 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)
16
Light Effects 4 Usually only considering reflected part Light absorbed transmitted reflected Light=refl.+absorbed+trans. Light ambient specular diffuse Light=ambient+diffuse+specular
17
Ambient Light 4 is the light in the environment evenly reaching all surfaces from all directions 4 light location doesn’t matter 4 eye position doesn’t matter 4 I A : ambient light 4 k a : material’s ambient reflection coefficient
18
Ambient Light 4 I A : ambient light 4 k a : material’s ambient reflection coefficient 4 Models general level of brightness in the scene 4 Accounts for light effects that are difficult to compute (secondary diffuse reflections, etc)
19
Ambient Light Example
20
Diffuse Light 4 Light absorbed by the surface and then reflected equally to all directions 4 Models dullness, roughness of a surface Light N L 4 I d : intensity of light source 4 k d : material’s diffuse reflection coefficient 4 N: normal vector (normalized) 4 L: light source vector (normalized) Lambert’s Law: (perfectly diffuse surface)
21
Diffuse Light
22
Diffuse Lighting Example
23
Specular Light 4 Light that is reflected from the surface unequally to all directions 4 Models reflections on shiny surfaces Light N L Eye R Phong’s Law: R n=inf. R n=large R n=small
24
Specular light example
25
Specular light calculation 4 The effect of ‘n’ in the phong model n = 10 n = 30 n = 90 n = 270
26
Depth Cueing/Illumination 4 Theory - illumination fall-off with square of distance 1/d 2 4 doesn’t give good results 4 often a factor of 1/d or 1/(d+c) is used 4 a way to simulate fog - linear fade … 4 use start s and end e fade distances 4 d = distance from viewer:
27
Depth Cueing/Illumination
28
Shading a Polygon 4 Illumination Model: determine the color of a surface (data) point by simulating some light attributes. 4 Local IM: deals only with isolated surface (data) point and direct light sources. 4 Global IM: takes into account the relationships between all surfaces (points) in the environment. 4 Shading Model: applies the illumination models at a set of points and colors the whole scene. 4 Texture Mapping: remappes and avgs. any value above (diffuse) from a 2d picture or map
29
Shading Polyhedra 4 Flat (facet) shading: –Works well for objects really made of flat faces. –Appearance depends on number of polygons for curved surface objects. 4 If polyhedral model is an approximation then need to smooth.
30
Interpolated shading. 4 Wylie, Romney, Evans and Erdahl pioneered linear interpolation of shading information from the vertices. 4 Gouraud generalized this to arbitrary polygons. 4 Interpolate illumination in same manner as we interpolated z for z-buffering. –Not physically correct for illumination. 4 Assumption of polygon approximating a curved surface gives rise to largest error.
31
Gouraud shading
32
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.
33
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. 1 provides broad, gentle falloff Higher values simulate sharp, focused highlight. For perfect reflector, n would be infinite.
34
Specular Small n Large n
35
Shading - efficiently 4 Constant Shading: 4 compute illumination at one point of the primitive (e.g. surface) and apply it for the whole primitive. 4 Interpolated Shading: 4 compute illumination at borders (e.g. vertices) of the primitive and interpolate the color 4 Accurate Shading: 4 compute illumination at every point of the primitive I1I1 I2I2 I3I3
36
Flat Shading 4 Polygon meshes approximate smooth curved surfaces with planar facets. Using the previous methods does not generate an illusion of smooth curved surface. 4 Reason: discontinuity of the normal vectors. N1N1 N2N2
37
Gouraud Shading 4 Assign vertex the normal of the smooth surface. Or 4 Average the normal of all neighboring polygons N1N1 N2N2 N 4 Interpolate colors along edges and scan-lines
38
Gouraud Shading Flat Shading
39
Phong Shading 4 Gouraud Shading does not properly handle specular highlights. 4 Reason: Colors are interpolated 4 Solution: –Compute averaged normal at vertices (Gouraud) –Interpolate normals along edges and scan lines! –Apply illumination model at every pixel
40
Phong Shading Gouraud Shading Phong Shading
41
SurfaceImage Texture Textures 4 Describe color variation in interior of 3D polygon –When scan converting a polygon, vary pixel colors according to values fetched from a texture Angel Figure 9.3
42
Surface Textures 4 Add visual detail to surfaces of 3D objects Polygonal model With surface texture
43
Surface Textures 4 Add visual detail to surfaces of 3D objects
44
Parameterization geometry + = image texture map Q: How do we decide where on the geometry each color from the image should go?
45
Option: Varieties of projections
46
Texture Mapping 4 Steps: –Define texture –Specify mapping from texture to surface –Lookup texture values during scan conversion (0,0) (1,0) (0,1) u v x y Modeling Coordinate System Image Coordinate System s t Texture Coordinate System
47
Texture Mapping 4 When scan convert, map from … –image coordinate system (x,y) to –modeling coordinate system (u,v) to –texture image (t,s) (0,0) (1,0) (1,1) (0,1) u v x y Modeling Coordinate System Image Coordinate System s t Texture Coordinate System
48
Texture Mapping 4 Scan conversion –Interpolate texture coordinates down/across scan lines –Distortion due to bilinear interpolation approximation
49
Texture Filtering Angel Figure 9.5 4 Aliasing is a problem Point sampling Area filtering
50
Texture Filtering Angel Figure 9.14 4 Size of filter depends on projective warp –Can prefiltering images MagnificationMinification
51
Mip Maps 4 Keep textures prefiltered at multiple resolutions –For each pixel, linearly interpolate between two closest levels (e.g., trilinear filtering) –Fast, easy for hardware
52
What is a Texture? 4 MAP surface detail from a predefined (easy table (“texture”) to a simple polygon 4 Color 4 specular ‘color’ (environment map) 4 normal vector perturbation (bump 4 map) 4 displacement mapping 4 transparency 4...
53
Bump Mapping 4 Modifies the direction of the surface normal.
54
Texture and Bump Mapping 4 Diffuse and normal remapping
55
Displacement Mapping 4 Modifies the surface position in the direction of the surface normal.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.