1 z-buffer and shading ©Anthony Steed 1999. 2 Overview n Coping with depth Scan-line depth buffering Z-buffer Recursive sub-division Trade-offs n gouraud.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

3D Graphics Rendering and Terrain Modeling
03/12/02 (c) 2002 University of Wisconsin, CS559 Last Time Some Visibility (Hidden Surface Removal) algorithms –Painter’s Draw in some order Things drawn.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Hidden Surface Removal Why make the effort?  Realistic models.  Wasted time drawing. OpenGL and HSR  OpenGL does handle HSR using the depth buffer.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실.
Part I: Basics of Computer Graphics
Different types of Polygons Simple Convex Simple Concave Non-simple : self-intersecting With holes ConvexConcaveSelf-intersecting.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Computer Graphics 14: Surface Detection Methods
Hidden Surface Elimination Wen-Chieh (Steve) Lin Institute of Multimedia Engineering I-Chen Lin’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
CS248 Final Review Derek Chan and Abe Davis. CS248 Final Monday, December 8, 3:30 to 6:30 pm Closed book, closed notes Mainly from material in the second.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models.
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
Introduction to 3D Graphics Lecture 6: Real-Time Rendering Anthony Steed University College London.
Graphics Pipeline Hidden Surfaces CMSC 435/634. Visibility We can convert simple primitives to pixels Which primitives (or parts of primitives) should.
Graphics Pipeline Hidden Surface CMSC 435/634. Visibility We can convert simple primitives to pixels/fragments How do we know which primitives (or which.
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
Polygon Scan Conversion and Z-Buffering
Computer Graphics Panos Trahanias ΗΥ358 Spring 2009.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
1 Texture Mapping ©Anthony Steed Overview n Texture mapping Inverse and Forward Mapping Bilinear interpolation Perspective correction n Mipmapping.
CS 376 Introduction to Computer Graphics 04 / 11 / 2007 Instructor: Michael Eckmann.
COMP 261 Lecture 16 3D Rendering. input: set of polygons viewing direction direction of light source(s) size of window. output: an image Actions rotate.
Shading & Texture. Shading Flat Shading The process of assigning colors to pixels. Smooth Shading Gouraud ShadingPhong Shading Shading.
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
From Vertices to Fragments II Software College, Shandong University Instructor: Zhou Yuanfeng
Visible-Surface Detection Jehee Lee Seoul National University.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
CS 325 Introduction to Computer Graphics 03 / 22 / 2010 Instructor: Michael Eckmann.
Binary Space Partitioning Trees Ray Casting Depth Buffering
Hidden Surface Removal
Implementation II.
Komputer Grafik 2 (AK045206) Shading 1/17 Realisme : Shading.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
CS 445 / 645 Introduction to Computer Graphics Lecture 15 Shading Shading.
1 3D Hidden Surface Removal 김 성 남. 2 Contents Goal Motivation Approaches - back face detection - depth buffer - A-buffer - Scan line - Depth.
Local Illumination and Shading
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
Computer Graphics I, Fall 2010 Implementation II.
Image Space Rendering and Texturing ©Celine Loscos 2004 Anthony Steed 1999.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
Render methods. Contents Levels of rendering Wireframe Plain shadow Gouraud Phong Comparison Gouraud-Phong.
01/28/09Dinesh Manocha, COMP770 Visibility Computations Visible Surface Determination Visibility Culling.
COMPUTER GRAPHICS CS 482 – FALL 2015 NOVEMBER 10, 2015 VISIBILITY CULLING HIDDEN SURFACES ANTIALIASING HALFTONING.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Lecture 30: Visible Surface Detection
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
Computer Graphics Implementation II
Prof. Harriet Fell Spring 2007 Lecture 26 – March 19, 2007
3D Graphics Rendering PPT By Ricardo Veguilla.
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Implementation II Ed Angel Professor Emeritus of Computer Science
Lecture 13 Clipping & Scan Conversion
Hidden Surface Removal
Introduction to Computer Graphics with WebGL
Illumination and Shading
Computer Graphics Material Colours and Lighting
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Where We Stand At this point we know how to: Next thing:
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Implementation II Ed Angel Professor Emeritus of Computer Science
Visible-Surface Determination
Presentation transcript:

1 z-buffer and shading ©Anthony Steed 1999

2 Overview n Coping with depth Scan-line depth buffering Z-buffer Recursive sub-division Trade-offs n gouraud shading n phong shading

3 Extending the AET n Easy enough if polygon do NOT intersect n Put all polygon edges into ET with extra depth information and proceed as before except … n … now consider overlapping ranges of edges

4 AET Example

5 AET Example Notes n Our edge table must contain data which enables us to look up z at at intersection point n From x1 to x2 only A is considered. n At x2 A and B are considered plane equations are solved to get depth A is closest so x2 to x3 is filled as A n At x3 A finishes so we draw B from x3 to x4 n At x4 B and C are considered, B in front etc… n Would usually store this in a 1D BSP tree for large numbers of polygons!

6 zbuffer n Don’t bother with per span tests - just test every pixel n Most common usage is a a full window sized array (M*N) of 16, 24 or 32 bit “depth” values. n Basic idea: For each pixel in each polygon –IF col = colour on polygon at unprojected point x,y –If z < ZBUF[x,y] set CBUF[x,y] = col Initialise buffer to Z_MAX

7 Zbuffer Details n Can do this in several ways n 1D z-buffer re-used on each scan line Process each polygon with separate AET Use as adjunct to extended AET for multiple polygons n Problems … Aliasing on depth (z-buffer tearing)

8 Scanning Depth into the Zbuffer n Now we have to write a z-value for each point directly from plane equation (re-calculate for each point) incremental across the scan-line (store z_start and dz) interpolate …

9 Interpolating Depth n Interpolate z along edges AND interpolate between edges on each scan-line (bi-linear interpolation) (X1,Y1,Z1) (X2,Y2,Z2) (XL,YL,ZL) (XR,YR,ZR)

10 Zbuffer Fill Example n General form of ET (y2,x1,dx/dy,z1,dz/dy) n ET[1] = ac (7,3,1/6,1,3/6) ab (4,3,4/3,1,1/3) n ET[4] = cb (7,7,-1,2,2/3) a=(3,1,1) b=(7,4,2) c=(4,7,4)

11 …Contents of AET n Scanline y=1 ac (7,3,1/6,1,3/6) ab (4,3,4/3,1,1/3) zspans 1 to 1 n y=2 ac (7,3.166,1/6,1.5,3/6) ab (4,4.333,4/3, 1.333, 1/3) zspans 1.5 to n y3 ac (7,3.333,1/6,2.0,3/6) ab (4,5.666, 4/3, 1.666, 1/3) zspans 2 to 1.666

12 Recursive Subdivision Visibility n The window is covered by a polygon that is in front of all others (draw it) n The window does not intersect a polygon (draw nothing) n The window overlaps a single polygon (draw it clipped) n The window contains a single polygon (draw it unclipped) n ELSE quarter rectangle and repeat

13 Trade-Offs n Zbuffer can be inaccurate with few bits really simple to implement though! n Scan-line AET good for large polygons good coherency across lines requires non-intersecting polygons n zbuffer good for small, sparse polygons AET more time consuming to maintain

14 Gouraud Shading n Recall simple model for local diffuse reflection n Gouraud interpolates this colour down edges and across scan-lines in the same manner as we just did for depth

15 Gouraud Details n ET now contains (y2,x1,dx,z1,dz,r1,dr,g1,dg,b1,db) –(we are running out of registers!) n Problems not constant colour on rotation of points misses specular highlights

16 Phong Shading n Include specular component n Interpolate normals across the scan-line instead of colours n Recaptures highlights in the centre of polygons