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

Slides:



Advertisements
Similar presentations
Computer Graphics - Shading -
Advertisements

1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 6.
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
1 Computer Graphics By : Mohammed abu Lamdy ITGD3107 University of Palestine Supervision: Assistant Professor Dr. Sana’a Wafa Al-Sayegh.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
Lecture 4: 3D Rendering Pipeline (I) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
IMGD 1001: Illumination by Mark Claypool
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
Lighting and Shading Wen-Chieh (Steve) Lin
(conventional Cartesian reference system)
3/23/2005 © Dr. Zachary Wartell 1 Illumination Models and Surface- Rendering Methods.
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
7M836 Animation & Rendering
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
Coordinate Systems X Y Z (conventional Cartesian reference system) X Y Z.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Lighting & Shading.
02/04/03 Page 1 Rendering Visibility Lighting Texturing.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Shading Surface can either (both) 1.Emit light. E.g. light bult 2.Reflect light. E.g. Mirror.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
CS 445 / 645: Introductory Computer Graphics
Computer Graphics Lighting.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
CS 445 / 645: Introductory Computer Graphics Light.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
CSE 381 – Advanced Game Programming GLSL Lighting.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Illumination and Shading
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Day 06 Vertex Shader for Ambient-Diffuse-Specular Lighting.
A Photograph of two papers
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Lighting.
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
1 Topics: Rendering Systems Basic 3D Concept Rendering System 3D Graphic Effect.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Computer Graphics: Illumination
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Chapter 5. Lighting Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
Computer Graphics (fall,2010) School of Computer Science University of Seoul Minho Kim.
© University of Wisconsin, CS559 Spring 2004
Hidden Surface Removal
Software Rasterization
Lighting.
CSE 470 Introduction to Computer Graphics Arizona State University
CS5500 Computer Graphics May 29, 2006
Illumination and Shading
Last Time Liang-Barsky Details Weiler-Atherton clipping algorithm
CS 480/680 Computer Graphics Shading.
Presentation transcript:

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

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

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

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

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

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

7 Viewing Frustum Near plane Far plane Viewer’s position

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

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 Backface Culling Determine “facing direction” Triangle order matters How to compute a normal vector for 2 given vectors? Cross product –Using Cross product of 2 given vectors (c1, c2, c3) (b1, b2, b3) (a1, a2, a3) Cross product 2 Vectors

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

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

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

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

16 Backface Culling Method (dot product)

17 When to Perform Backface Culling? ClippingPerspective DivideViewport Transform Rasterization Projection TransformWorld TransformView TransformLighting Backface Culling ClippingPerspective DivideViewport Transform Rasterization Projection TransformWorld TransformView TransformLightingBackface 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) P=(1, 2, 3) K=(x, y, z) Plane equation 5*(x-1)+6*(y-2)+7*(z-3)=0

21 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 Normal R   d d  P

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

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

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 Common Light Sources Directional Light (Infinitely far away) Point Light (Emit in all directions) Spot Light (Emit within a cone) Inner cone outer cone

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

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

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

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

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

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

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

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

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

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

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

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

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