The Framebuffer 1 Lecture 37 Fri, Nov 30, 2007.

Slides:



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

8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
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.
CSC418 Computer Graphics n Polygon normals n Back Faces n Visibility Algorithms.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
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.
Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실.
Part I: Basics of Computer Graphics
Compositing and Blending - Chapter 8 modified by Ray Wisman Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
Hidden Surface Removal April 30, Hidden Surface Removal Object-space algorithms: –Back-face culling (removal) –Depth sorting and Painter’s algorithm.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
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.
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Computer Graphics Mirror and Shadows
Chapter 2 Getting Started: Drawing Figures. The Framebuffer Lecture 2 Fri, Aug 29, 2003.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
10/26/04© University of Wisconsin, CS559 Fall 2004 Last Time Drawing lines Polygon fill rules Midterm Oct 28.
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.
1 10/24/ :01 UML Graphics II Shadows Session 4.
1 Computer Graphics Week2 –Creating a Picture. Steps for creating a picture Creating a model Perform necessary transformation Lighting and rendering the.
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Hidden Surface Removal
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Visible Surface Determination (VSD) To render or not to render, that is the question… 1 of.
Color spaces. Draw Buffers Color models. Mathmatical Protocols for defining colors with numbers  RGB Red, Green, Blue  HSV Hue, Saturation, Value(Brightness)‏
Visible Surface Detection
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
Visible surface determination. Problem outline Given a set of 3D objects and a viewing specification, we wish to determine which lines or surfaces are.
1 Computer Graphics Week11 : Hidden Surface Removal.
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 (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Visible surface determination
Visible Surface Detection
Images Data Representation.
Week 7 - Monday CS361.
Week 2 - Friday CS361.
(c) 2002 University of Wisconsin, CS559
Hidden Surface Removal
CSC418 Computer Graphics Back Faces Visibility Algorithms.
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
CSC461: Lecture 20 Parallel Projections in OpenGL
Hidden Surfaces Dr. Scott Schaefer.
© University of Wisconsin, CS559 Spring 2004
CSCE 441: Computer Graphics Hidden Surface Removal
Introduction to Computer Graphics with WebGL
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Visibility (hidden surface removal)
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Chapter X Output Merger.
Ref: OpenGL Programming Guide (The Red Book)
Sweep Fill Details For row = min to row=max
Hidden Surface Removal
Presentation transcript:

The Framebuffer 1 Lecture 37 Fri, Nov 30, 2007

The Framebuffer The framebuffer consists of several separate buffers. The color buffer(s) Front buffer, back buffer, right buffer, left buffer. The depth buffer The stencil buffer The accumulation buffer. The right and left buffers are used for stereoscopic viewing.

The Color Buffer A particular computer may not have the right buffer(s) and it may not have the back buffer(s). We will discuss the front left buffer. The others are similar.

The Color Buffer If the screen resolution is 1024  768, then there are 786432 pixels on the screen. The color buffer stores 24 bits per pixel – 8 for red, 8 for green, 8 for blue. That’s a total of 2359296 bytes, or 2.25 Mb. Typically, the color buffer also stores 8 bits for the alpha value. Then the total is 3 Mb.

The Color Buffer If there is a back buffer, that’s another 3 Mb, for a total of 6 Mb. If there are stereo buffers (and a back buffer), then the total is 12 Mb.

The Framebuffer Read Run

Perspective Division The GPU divides the x-, y-, and z-coordinates by the w-coordinate, producing normalized device coordinates. In normalized device coordinates, we have -1  x  1 -1  y  1 -1  z  1 In the z-direction, the z-value becomes the depth of the point.

The Depth Buffer z is transformed one last time to the range 0 to 1, called the pseudo-depth. The depth of each point is stored in the depth buffer, also called the z-buffer. Collectively, all the information stored in the buffers for a point is called a fragment. A pixel is only the RGB values stored in the color buffer.

Hidden-Surface Removal How do we determine when one object obstructs another object from view? For each point of each object, we could extend a line from the viewpoint through that point and see if it intersects any point of any other object. This would be extremely time consuming!

The Painter’s Algorithm A simple algorithm is to sort the objects according to their distance from the viewpoint. Then draw them from furthest to nearest. There are some problems with this idea.

The Painter’s Algorithm Which object is nearest? furthest? Eye

The Painter’s Algorithm Which object is nearest? furthest? red green blue yellow Eye

The Painter’s Algorithm Which object is nearest? furthest? yellow red blue green Eye

The Depth Buffer In the depth buffer, lower z-values are closer to the viewer. If two points have the same x- and y-coordinates, the one with the lower z-coordinate should be drawn (normally).

Hidden-Surface Removal The objects to be drawn may be placed in the pipeline in any order. When a new fragment “arrives” at the framebuffer, its z-coordinate is compared to the z-coordinate of the fragment currently at that (x, y) location. If the new fragment is closer to the viewer, then it replaces the current fragment.

Hidden-Surface Removal Once all the fragments have arrived, the ones left in the color buffer are the ones to be rendered on the screen.

Depth Testing Depth-buffer testing must be enabled using glEnable(GL_DEPTH_TEST); Then the depth buffer must be cleared, or else the old values will interfere with the new calculations. glClearDepth(1.0); It is cleared to 1.0, which represents the furthest from the viewer; 0.0 represents the nearest.

Depth Testing Finally, the type of depth testing may be set using glDepthFunc(). The choices are GL_NEVER, GL_ALWAYS, GL_EQUAL, GL_NOTEQUAL, GL_LESS, GL_GREATER, GL_LEQUAL, GL_GEQUAL. We normally use GL_LESS or GL_LEQUAL.

Depth Testing Read Run