Chapter X Output Merger.

Slides:



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

Compositing and Blending Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics.
Hank Childs, University of Oregon Nov. 25th, 2014 CIS 441/541: Introduction to Computer Graphics Lecture 15: animation, transparency.
The Buffers and Operations
Framebuffer in OpenGL MAE152 Computer Graphics for Scientists and Engineers Fall 03.
OpenGL Fragment Operations
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
OPENGL Return of the Survival Guide. Buffers (0,0) OpenGL holds the buffers in a coordinate system such that the origin is the lower left corner.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
University of Sulaimani - School of Science - Computer Dept.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Compositing and Blending Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Blending MAE152 Computer Graphics for Engineers and Scientists Fall 03.
Compositing and Blending - Chapter 8 modified by Ray Wisman Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Image Compositing Angel 8.11 Angel: Interactive Computer Graphics5E © Addison-Wesley
Chapter 6. More on Color and Material Presented by Garrett Yeh.
Raster Displays Images are composed of arrays of pixels displayed on a raster device. Two main ways to create images: –Scan and digitize an existing image.
7/2/2006Based on: Angel (4th Edition) & Akeine-Möller & Haines (2nd Edition)1 CSC345: Advanced Graphics & Virtual Environments Lecture 4: Visual Appearance.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
Geometric Objects and Transformations. Coordinate systems rial.html.
Informationsteknologi Monday, November 26, 2007Computer Graphics - Class 121 Today’s class Drawing lines Bresenham’s algorithm Compositing Polygon filling.
Chapter 2 Getting Started: Drawing Figures. The Framebuffer Lecture 2 Fri, Aug 29, 2003.
Lecture 12 Blending, Anti-aliasing, Fog, Display Lists.
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.
OpenGL Blending Akbar Ali
3D Graphics for Game Programming Chapter IV Fragment Processing and Output Merging.
1 10/24/ :01 UML Graphics II Shadows Session 4.
DREAM PLAN IDEA IMPLEMENTATION Introduction to Computer Graphics Dr. Kourosh Kiani
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 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
OpenGL Architecture Display List Polynomial Evaluator Per Vertex Operations & Primitive Assembly Rasterization Per Fragment Operations Frame Buffer Texture.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Compositing and Blending
Computer Graphics Blending CO2409 Computer Graphics Week 14.
1 Graphics CSCI 343, Fall 2015 Lecture 5 Color in WebGL.
Mobile Graphics Patrick Cozzi University of Pennsylvania CIS Spring 2012.
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
UniS CS297 Graphics with Java and OpenGL Blending.
OpenGL Special Effects Jian-Liang Lin 2002 Blending: Alpha Channel Alpha value can be specify by glColor* When blending is enabled, the alpha value is.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Compositing and Blending Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
The Framebuffer Hyun-Chul Cho. HyunChul Cho - KUCG -2 Buffer Goal of a graphics program Draw pictures on the screen Screen Rectangular array.
Computer Graphics I, Fall 2008 Compositing and Blending.
CS 418 : EXAM 2 REVIEW TA: Ryan Freedman Sushma Kini Chi Zhou.
Chapter 6. Blending, Antialiasing, Fog, and Polygon Offset Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
CS 4722 Made by Dr. Jeffrey Chastine Modified by Dr. Chao Mei
Textures, Sprites, and Fonts
Discrete Techniques.
Week 7 - Monday CS361.
Draw a Simple Object.
Introduction to Computer Graphics with WebGL
The Graphic PipeLine
Visual Appearance Chapter 4
Deferred Lighting.
I = a I + ( ) 1 – a I BLENDING, ANTIALIASING, AND FOG l l 1 l 2 Earth
OpenGL Buffers and Tests
Chapters VIII Image Texturing
Making the Applications Interesting
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Chapter VII Rasterizer
Visibility (hidden surface removal)
Blending CSCI 440 textbook section 7.10
Texture and Shadow Mapping
Computer Graphics Practical Lesson 7
Last Time Presentation of your game and idea Environment mapping
Ref: OpenGL Programming Guide (The Red Book)
The Framebuffer 1 Lecture 37 Fri, Nov 30, 2007.
Presentation transcript:

Chapter X Output Merger

Where are We? We’ve just left the fragment shader that operates on each fragment and determines its color through various operations such as texturing and lighting. The fragment shader has processed screen-space fragments and we are still in the screen space.

Color and Depth Buffers GL supports three kinds of buffers. Color buffer is a memory space storing the pixels to be displayed on the screen Depth buffer or z-buffer has the same resolution as the color buffer, and records the z-values of the pixels currently stored in the color buffer. Stencil buffer will not be discussed in this class. The collection of these three is called the frame buffer. Given the following viewport, we have wh-resolution color and depth buffers.

Z-buffering The output of the fragment shader is often called the RGBAZ fragment. A: alpha for representing the fragment's opacity Z: depth Using alpha and depth values, the fragment competes or is merged with the pixel of the color buffer. Z-buffering When a fragment at (x,y) is passed from the fragment shader, its z-value is compared with the z-buffer value at (x,y). If the fragment has a smaller z-value, its color and z-value are used to update the color buffer and z-buffer at (x,y), respectively. Otherwise, the fragment is discarded.

Z-buffering (cont’d) Assume maxZ is 1.0, the red triangle’s depth is 0.8, and the blue triangle’s is 0.5.

Z-buffering (cont’d) Rendering-order independence!!

Z-buffering in GL By calling glClear once per frame, three buffers are simultaneously cleared with the default values selected by the following: glClearColor glClearDepthf glClearStencil All tests and operations on fragments are disabled by default and are enabled by calling glEnable with the following arguments, for example: GL_DEPTH_TEST GL_BLEND (for blending fragments with colors stored in the color buffer) glDepthFunc(GLenum func) func specifies the conditions under which the fragment is drawn. The default is GL_LESS, which means that the fragment is drawn if its depth is less than that of the pixel.

Alpha Blending The alpha channel in the range of [0,1] 0 denotes “fully transparent.” 1 denotes “fully opaque.” A typical blending equation is described as follows: For alpha blending, the primitives cannot be rendered in an arbitrary order. They must be rendered after all opaque primitives, and in back-to-front order. Therefore, the partially transparent objects should be sorted.

Alpha Blending in GL glBlendFunc(GLenum sfactor, GLenum dfactor); sfactor specifies the blending coefficient for the incoming (source) fragment dfactor specifies the blending coefficient for the destination pixel Many values such as GL_ZERO and GL_ONE can be assigned to sfactor and dfactor, but GL_SRC_ALPHA may best fit to sfactor and GL_ONE_MINUS_SRC_ALPHA to dfactor. Once the fragment and pixel color are multiplied by sfactor and dfactor, respectively, they are combined using the operator specified by glBlendEquation. Its argument can be GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MIN, or GL_MAX. The default is GL_FUNC_ADD.