15.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 15 – Visible Surfaces and Shadows.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 18 Image-based Rendering Final Review of Rendering What We Did Not Cover Learning More...
GR2 Advanced Computer Graphics AGR
GR2 Advanced Computer Graphics AGR
GR2 Advanced Computer Graphics AGR
GR2 Advanced Computer Graphics AGR
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 6 Physically Based Reflection Model.
SI23 Introduction to Computer Graphics
SI23 Introduction to Computer Graphics
SI23 Introduction to Computer Graphics
GR2 Advanced Computer Graphics AGR
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 16 Radiosity - continued.
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
7.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 7 Polygon Shading Techniques.
5.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 5 A Simple Reflection Model.
9.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
SI31 Advanced Computer Graphics AGR
8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing.
Computer Graphics An Introduction. What’s this course all about? 05/10/2014 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
Saito, T. and Takahashi, T. Comprehensible Rendering of 3-D Shapes Proc. of SIGGRAPH '90 Genesis of Image Space NPR.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 4 View Projection Taku Komura.
Lecture 8 Transparency, Mirroring
Compositing and Blending Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics.
Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Graphics Pipeline.
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
1 Computer Graphics Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Part I: Basics of Computer Graphics
Computer Graphics - Class 10
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
7M836 Animation & Rendering
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
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.
Hidden Surface Removal
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
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.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Taku KomuraComputer Graphics Local Illumination and Shading Computer Graphics – Lecture 10 Taku Komura Institute for Perception, Action.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Programming 3D Applications CE Displaying Computer Graphics Week 3 Lecture 5 Bob Hobbs Faculty of Computing, Engineering and Technology Staffordshire.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Computer Graphics Blending CO2409 Computer Graphics Week 14.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Visible Surface Determination (VSD) To render or not to render, that is the question… 1 of.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Lecture 30: Visible Surface Detection
Visible surface determination
Visible Surface Detection
Computer Graphics Chapter 9 Rendering.
Hidden Surface Removal
3D Graphics Rendering PPT By Ricardo Veguilla.
CSCE 441: Computer Graphics Hidden Surface Removal
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
Illumination and Shading
GR2 Advanced Computer Graphics AGR
Computer Graphics Material Colours and Lighting
Chapter 14 Shading Models.
Presentation transcript:

15.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 15 – Visible Surfaces and Shadows

15.2 Si23_03 The Story So Far for 3D Graphics n We now understand: – how to model objects as a set of polygonal facets and create a 3D world (Lectures 10 & 11) – how to view these worlds with a camera model, projecting the facets to 2D (Lectures 11&12) – how to calculate reflection off a surface (Lecture 13) – how to shade a single projected facet using the reflection calculation (Lecture 14) n Next step: rendering the visible facets in a scene

15.3 Si23_03 First a Word On Phong Shading and OpenGL n OpenGL supports two types of shading: glShadeModel(rendering Type) GL_FLAT: flat shading GL_SMOOTH: Gouraud shading n Why not Phong? n Phong needs normals passed through the pipeline to the screen space n OpenGL shades vertices in viewing co-ordinates and then discards normals from the pipeline.. So Phong shading impossible

15.4 Si23_03 Rendering Polygons n We are now ready to consider rendering a set of polygon facets visible n For efficiency, we only want to render those that are visible to the camera

15.5 Si23_03 Back Face Culling polyhedron back-facing n If the facets belong to a solid object (a polyhedron) we do not need to render back-facing polygons Here only three facets need to be drawn - those that face towards the camera

15.6 Si23_03 Back Face Culling n A polygon faces away from the viewer if the angle between the surface normal (N) and the viewing direction (V) is less than 90 degrees V.N > 0 camera V N

15.7 Si23_03 Back Face Culling n It is efficient to carry this out in the viewing co-ordinate system – camera on z-axis pointing in negative z- direction – so V = (0,0,-1) n Thus the V.N>0 test becomes a test only on z-component of normal vector N z < 0 – ie test if z-component of normal points in negative z-direction

15.8 Si23_03 Back Face Culling n Back face culling is an extremely important efficiency gain in rendering and is typically the first step in visibility processing glEnable(GL_CULL_FACE) glCullFace(GL_BACK) n We are left with a set of front facing polygons...

15.9 Si23_03 The Next Problem visible n Some facets will be obscured by others - we only want to draw (ie shade) the visible polygons

15.10 Si23_03 Solution - Z Buffer Algorithm n Suppose polygons have been passed through the projection transformation, with the z-co-ordinate retained (ie the depth information) - suppose z normalized to range 0 to 1 z x y view plane window For each pixel (x,y), we want to draw the polygon nearest the camera, ie largest z 0 1 camera

15.11 Si23_03 Z Buffer Algorithm n We require two buffers: – frame buffer – frame buffer to hold colour of each pixel (in terms of RGB)... typically 24 bits plus 8 bits for transparency (A or ) – z-buffer – z-buffer to hold depth information for each pixel... typically 16, 24 or 32 bits n Initialize: – frame buffer to the background colour of the scene colour (x,y) = (I RED, I GREEN, I BLUE ) background – z-buffer to zero (back clipping plane) depth (x,y) = 0

15.12 Si23_03 Z Buffer Algorithm n As each polygon is scan converted and shaded using Gouraud or Phong shading: – calculate depth z for each pixel (x,y) in polygon – if z > depth(x,y), then set: depth (x,y) = z; colour (x,y) = (I RED, I GREEN, I BLUE ) gouraud/phong n Opportunity to exploit coherence here… how? n After all polygons processed, depth buffer contains depth of visible surfaces, and frame buffer the colour of these surfaces

15.13 Si23_03 Z Buffer - Strengths and Weaknesses n A major advantage of the z-buffer algorithm is its simplicity n Weaknesses are: – Amount of memory required (now of decreasing importance) – Some calculations are wasted – why? – Limited precision for depth calculations in complex scenes can be a problem: z- fighting (why is this exacerbated by perspective transformation?) n In OpenGL: glEnable(GL_DEPTH_TEST) glClear(GL_DEPTH_BUFFER_BIT)

15.14 Si23_03.. And this years Oscar winner is n The z-buffer was invented by Ed Catmull in 1973 while a student… n … received Oscar in 2001 for Toy Story 2 working for Pixar n … but if only he had patented the z- buffer idea!

15.15 Si23_03 Transparency n Polygons in practice may be opaque or semi-transparent – in OpenGL =1 represents opaque n Simple rendering: – render opaque polygons first, generating colour (x,y) – for each semi-transparent polygon (with opacity ) render into another buffer as polygon (x,y) – and combine using: ( 1 - ) * colour (x,y) + * polygon (x,y)

15.16 Si23_03 Better Transparency n Better results by storing for each pixel the depth and transparency of each surface n Surfaces can then be composited back to front in order to give more accurate images

15.17 Si23_03 Shadows n Z buffers also give us a nice way of doing shadows n The z buffer is a way of determining what is visible to the camera n For shadows, we need a way of determining what is visible to the light source

15.18 Si23_03 Shadow Z Buffer n We require a second z-buffer, called a shadow z-buffer n Two step algorithm: – scene is rendered from the light source as viewpoint, with depth information stored in the shadow z-buffer (no need to calculate intensities) – scene is rendered from the camera position, using Gouraud or Phong shading with a z-buffer algorithm... but we need to adjust colour if point is in shadow

15.19 Si23_03 Shadow Z Buffer n To determine if point is in shadow: – take its position (x O, y O, z O ) in the camera view, and transform it into the corresponding position (x O, y O, z O ) in the light source view – look up the z value, say z L, in the shadow z-buffer at the position (x O, y O ) – if z L is closer to the light than z O, this means some object is nearer the light and therefore the point is in shadow... in this case only the ambient reflection would be shown at that point