1 / 39

Lecture 5: 3D Rendering Pipeline (II)

Lecture 5: 3D Rendering Pipeline (II). Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology. Parallel Projection. Project from 3D space to viewer’s 2D space. View plane. Viewer’s position. Perspective Projection.

aretha
Download Presentation

Lecture 5: 3D Rendering Pipeline (II)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 5: 3D Rendering Pipeline (II) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology

  2. Parallel Projection • Project from 3D space to viewer’s 2D space View plane Viewer’s position

  3. Perspective Projection • The farther the object is, the smaller it appears • Some photo editing software allows you to perform “Perspective Correction” View plane Viewer’s position

  4. y ys x xs d z Perspective Projection (x,y,z) (xs,ys,d) y z x

  5. y ys x xs d z Perspective Projection (x,y,z) (xs,ys,d) y z x

  6. Viewing Frustum Far plane Near plane Think about looking through a window in a dark room Viewer’s position

  7. Viewing Frustum Far plane Near plane Viewer’s position

  8. Define Viewing Frustum(Projection Transformation) +y Far z Width Near z fov/2 +z Viewer’s position Height Parameters: Fov: Field of View Aspect ratio = Width/Height Near z Far z

  9. Viewport Transformation • The actual 2D projection to the viewer • Copy to your back buffer (frame buffer) • Can be programmed, scaled, ..

  10. Other Geometry Optimizations • Backface Culling • Clipping • Hidden surface removal (Occlusion)

  11. 2 Vectors Cross product Backface Culling • Determine “facing direction” • Triangle order matters • How to compute a normal vector for 2 given vectors? • Using Cross product of 2 given vectors (a1, a2, a3) (c1, c2, c3) (b1, b2, b3)

  12. Compute the Surface Normal for a Triangle y (3, 3, 0) z v1 (0, 0, 0) x (4, 0, 0) v2 Compute Normals (Clockwise vectors)

  13. Compute the Surface Normal for a Triangle y (3, 3, 0) z v2 (0, 0, 0) x (4, 0, 0) v1 Compute Normals

  14. Backface Culling Method • Check if the normal is facing the camera • How to determine that? • Use Dot Product Surface vectors Eye vector

  15.  B A Backface Culling Method (dot product) 

  16. Backface Culling Method (dot product)

  17. Clipping View Transform World Transform Clipping Viewport Transform Projection Transform Lighting Perspective Divide World Transform Lighting Perspective Divide Viewport Transform Projection Transform View Transform Rasterization Rasterization Backface Culling When to Perform Backface Culling? Backface Culling How? Transform your camera to the world space first!

  18. 3D Clipping • Test 6 planes if a triangle is inside, outside, or partially inside the view frustum • Clipping creates new triangles (triangulation) • Interpolate new vertices info

  19. How to Clip Against a Plane? • Test each vertex of a triangle • Outside • Inside • Partially inside • Incurred computation overhead • Save unnecessary computation (and bandwidth) later • Need to know how to determine a plane • Need to know how to determine a vertex is inside or outside a plane

  20. What it Takes to Determine a Plane? • You need two things to specify a plane • A point on the plane (p0, p1, p2) • A vector (normal) perpendicular to the plane (a, b, c) • Plane a*(x – p0) + b*(y – p1) + c*(z - p2) = 0 V=(5, 6, 7) Plane equation 5*(x-1)+6*(y-2)+7*(z-3)=0 K=(x, y, z) P=(1, 2, 3)

  21. Normal   Distance Calculation from a Plane • Given a point R, calculate the distance • Distance > 0 inside the plane • Distance = 0 on the plane • Distance < 0 outside the plane R d d  P

  22.  Distance Calculation from a Plane P  d 180- R

  23. Triangulation using Interpolation (a2, b2, c2) (x, y, z) d2 d1 (a1, b1, c1)

  24. Illumination Models • It won’t look 3D without lighting • Part of geometry processing • Illumination Types • Ambient • Diffuse • Specular • Emissive

  25. Local vs. Global Illumination • Local Illumination • Direct illumination: Light shines on all objects without blocking or reflection • Used in most games • Global Illumination • Indirect illumination: Light bounces from one object to other objects • Add more realism (non real-time rendering) • Computationally much more expensive • Ray tracing, radiosity ?

  26. outer cone Inner cone Point Light (Emit in all directions) Spot Light (Emit within a cone) Common Light Sources Directional Light (Infinitely far away)

  27. RGB multiplies separately Material Color Light Color Illumination: Ambient Lighting • Not created by any light source • A constant lighting from all directions • Contributed by scattered light in a surrounding

  28. Illumination: Diffuse Lighting • Light sources are given • Assume light bounces in all directions Diffuse surface Refelcted Light will reach the eyes no matter where the camera is!

  29. intensity Surface Normal n Surface Normal n Surface Normal n     L F()=cos()  Dot product  Reflected Light Intensity Calculation • Reflectivity the entry angle • Use Lambert’s cosine Law Reflection Full Partial None

  30. Ambient + Diffuse Diffuse Illumination: Diffuse Lighting  Material Color Light Color Ambient + Diffuse

  31. Ambient + Diffuse + Specular Specular Illumination: Specular Lighting • Create shining surface (surface perfectly reflects) • Viewpoint dependent Material Color Light Color

  32. n  H    E L R Half-way vector Jim Blinn’s Specular Model • An improved version from Phong Specular model which uses Reflective vector R • “S” controls the bright region around surface

  33. H1 E1 n1 H2 L1 E2 L2 n2 Brightness Effect (S) More shining

  34. S=1 S=8 intensity H1 H1 H2 H2   cos n1 n1   n2 n2 cos2 cos8 ~0.62 cos64 ~0.05 Brightness Effect (S) ~0.95 cos > cos ~0.65 cos8 >>> cos8 radian

  35. Specular Lighting Effect • A larger S shows more concentration of the reflection

  36. Ambient + Diffuse + Specular + Emissive Illumination: Emissive Lighting • Color is emitted by the material only + Ambient + Diffuse + Specular Material Emissive Color

  37. outer cone Inner cone Point Light (Emit in all directions) Spot Light (Emit within a cone) Common Light Sources Directional Light (Infinitely far away)

  38. Light Source Properties • Position • Range • Specifying the visibility • Attenuation • The farther the light source, the dimmer the color

  39.   L d Falloff effect Spotlight Effect • Similar idea to specular lighting • Falloff factor determines the fading effect of a spotlight • “f” exponentially decreases the cos value

More Related