1 91.427 Computer Graphics I, Fall 2008 Compositing and Blending.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
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.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
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.
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 10 Alpha Blending and Fog © 2008 Cengage Learning EMEA.
Objectives Introduce OpenGL buffers and read/write Introduce OpenGL buffers and read/write Introduce texture mapping Introduce texture mapping Introduce.
Computer Graphics1 The A-buffer an Antialiased Hidden Surface Method.
Chapter 6. More on Color and Material Presented by Garrett Yeh.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1Notes. 2Atop  The simplest (useful) and most common form of compositing: put one image “atop” another  Image 1 (RGB) on top of image 2 (RGB)  For.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
7/2/2006Based on: Angel (4th Edition) & Akeine-Möller & Haines (2nd Edition)1 CSC345: Advanced Graphics & Virtual Environments Lecture 4: Visual Appearance.
02/14/02(c) University of Wisconsin 2002, CS 559 Last Time Filtering Image size reduction –Take the pixel you need in the output –Map it to the input –Place.
CSE (Notre Dame) Computer Graphics Lecture 16 A Simple Draw Image Example More Texture Mapping Simple OpenGL Image Library (SOIL) Transparency &
Tools for Raster Displays CVGLab Goals of the Chapter To describe pixmaps and useful operations on them. To develop tools for copying, scaling, and rotating.
Antialiasing CAP4730: Computational Structures in Computer Graphics.
Lecture 12 Blending, Anti-aliasing, Fog, Display Lists.
Filtering and Color To filter a color image, simply filter each of R,G and B separately Re-scaling and truncating are more difficult to implement: –Adjusting.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
Visible-Surface Detection Jehee Lee Seoul National University.
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 Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
Chapter 8: Discrete Techniques Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.
Discrete Techniques Chapter 7 Begun February 22, 2005 Finished April 26, 2005.
Real-Time rendering Chapter 4.Visual Appearance 4.4. Aliasing and antialiasing 4.5. Transparency,alpha,and compositing 4.6. Fog 4.7. Gamma correction
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee.
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.
Sort-Independent Alpha Blending Houman Meshkin
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Discrete Techniques Chapter 7.
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
UniS CS297 Graphics with Java and OpenGL Blending.
Computer Graphics I, Fall 2010 Implementation II.
Buffers, Compositing and Blending Week 8 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New.
CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008.
Chapter 13 Special Visual Techniques. Blending ◦ Without blending, a source fragment’s color values are supposed to overwrite those of its destination.
Compositing and Blending Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Chapter 6. Blending, Antialiasing, Fog, and Polygon Offset Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
Hank Childs, University of Oregon
Discrete Techniques.
Week 7 - Monday CS361.
Introduction to Computer Graphics with WebGL
Week 2 - Friday CS361.
Visual Appearance Chapter 4
The Graphics Rendering Pipeline
Advanced Graphics Algorithms Ying Zhu Georgia State University
I = a I + ( ) 1 – a I BLENDING, ANTIALIASING, AND FOG l l 1 l 2 Earth
CSc4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Fog and Transparency.
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Geometric Transformations for Computer Graphics
blending blending textures reflection fog
UMBC Graphics for Games
Three-Dimensional Graphics VI
Computer Graphics Practical Lesson 7
Chapter X Output Merger.
blending blending textures reflection fog
Computer Graphics Image processing 紀明德
Presentation transcript:

Computer Graphics I, Fall 2008 Compositing and Blending

Computer Graphics I, Fall 2008 Objectives Learn to use the A component in RGBA color for ­Blending for translucent surfaces ­Compositing images ­Antialiasing

Computer Graphics I, Fall 2008 Opacity and Transparency Opaque surfaces permit no light to pass through Transparent surfaces permit all light to pass Translucent surfaces pass some light translucency = 1 – opacity (  ) opaque surface  =1

Computer Graphics I, Fall 2008 Physical Models Dealing with translucency in physically correct manner difficult due to ­complexity of internal interactions of light and matter ­Using pipeline renderer

Computer Graphics I, Fall 2008 Writing Model Use A component of RGBA (or RGB  ) color to store opacity During rendering can expand writing model to use RGBA values Color Buffer destination component blend destination blending factor source blending factor source component

Computer Graphics I, Fall 2008 Blending Equation Can define source and destination blending factors for each RGBA component s = [s r, s g, s b, s  ] d = [d r, d g, d b, d  ] Suppose source and destination colors are b = [b r, b g, b b, b  ] c = [c r, c g, c b, c  ] Blend as c’ = [b r s r + c r d r, b g s g + c g d g, b b s b + c b d b, b  s  + c  d  ]

Computer Graphics I, Fall 2008 OpenGL Blending and Compositing Must enable blending and pick source and destination factors glEnable(GL_BLEND) glBlendFunc(source_factor, destination_factor) Only certain factors supported ­GL_ZERO, GL_ONE ­GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ­GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA ­See Redbook for complete list

Computer Graphics I, Fall 2008 Example Suppose start with opaque background color (R 0,G 0,B 0,1) ­==> initial destination color Now want to blend in translucent polygon with color (R 1,G 1,B 1,  1 ) Select GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA as source and destination blending factors R ’ 1 =  1 R 1 +(1-  1 ) R 0, …… Note this formula correct if polygon either opaque or transparent

Computer Graphics I, Fall 2008 Clamping and Accuracy All components (RGBA) clamped and stay in range (0,1) However, in typical system, RGBA values only stored to 8 bits ­Can easily lose accuracy if add many components together ­Example: add together n images Divide all color components by n to avoid clamping Blend with source factor = 1, destination factor = 1 But division by n loses bits

Computer Graphics I, Fall 2008 Order Dependency Is this image correct? ­Probably not ­Polygons rendered in order they pass down pipeline ­Blending functions are order dependent

Computer Graphics I, Fall 2008 Opaque and Translucent Polygons Suppose have group of polygons some opaque, some translucent How use hidden-surface removal? Opaque polygons block all polygons behind them and affect depth buffer Translucent polygons should not affect depth buffer ­Render with glDepthMask(GL_FALSE) which makes depth buffer read-only Sort polygons first to remove order dependency

Computer Graphics I, Fall 2008 Fog Can composite with fixed color and have blending factors depend on depth ­Simulates fog effect Blend source color C s and fog color C f by C s ’=f C s + (1-f) C f f is fog factor ­Exponential ­Gaussian ­Linear (depth cueing)

Computer Graphics I, Fall 2008 Fog Functions

Computer Graphics I, Fall 2008 OpenGL Fog Functions GLfloat fcolor[4] = {……}: glEnable(GL_FOG); glFogf(GL_FOG_MODE, GL_EXP); glFogf(GL_FOG_DENSITY, 0.5); glFOgv(GL_FOG, fcolor);

Computer Graphics I, Fall 2008 Line Aliasing Ideal raster line = one pixel wide All line segments, other than vertical and horizontal segments, partially cover pixels Simple algorithms color only whole pixels Lead to “jaggies” or aliasing Similar issue for polygons

Computer Graphics I, Fall 2008 Antialiasing Can try to color pixel by adding fraction of its color to frame buffer ­Fraction depends on percentage of pixel covered by fragment ­Fraction depends on whether there is overlap no overlapoverlap

Computer Graphics I, Fall 2008 Area Averaging Use average area  1 +  2 -  1  2 as blending factor

Computer Graphics I, Fall 2008 OpenGL Antialiasing Can enable separately for points, lines, or polygons glEnable(GL_POINT_SMOOTH); glEnable(GL_LINE_SMOOTH); glEnable(GL_POLYGON_SMOOTH); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Computer Graphics I, Fall 2008 Accumulation Buffer Compositing and blending limited by resolution of frame buffer ­Typically 8 bits per color component Accumulation buffer = high resolution buffer (16 or more bits per component) ==> avoids this problem Write into it or read from it with scale factor Slower than direct compositing into frame buffer

Computer Graphics I, Fall 2008 Applications Compositing Image Filtering (convolution) Whole scene antialiasing Motion effects