Lecture 12 Blending, Anti-aliasing, Fog, Display Lists.

Slides:



Advertisements
Similar presentations
Compositing and Blending Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics.
Advertisements

CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
OpenGL Fragment Operations
Graphics Pipeline.
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
Computer Graphics(Fall 2003) COMS 4160, Lecture 7: OpenGL 3 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Projective Texture Mapping
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
1. 2 Blending: tells you how to specify a blending function that combines color values from a source and a destination. The final effect is that parts.
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
Objectives Introduce OpenGL buffers and read/write Introduce OpenGL buffers and read/write Introduce texture mapping Introduce texture mapping Introduce.
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.
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.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows.
Guilford County Sci Vis V204.01
MAE152 Computer Graphics for Scientists and Engineers Antialiasing Fall 2003.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Emerging Technologies for Games Alpha Sorting and “Soft” Particles CO3303 Week 15.
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.
OpenGL Blending Akbar Ali
1 Chapter 6 Blending, Antialiasing, Fog, and Polygon Offset Guihua Yang Jan 14, 2004.
DREAM PLAN IDEA IMPLEMENTATION Introduction to Computer Graphics Dr. Kourosh Kiani
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
MAE152 Computer Graphics for Scientists and Engineers Fall 03 Display Lists.
1 3D API OPENGL ES v1.0 Owned by Silicon Graphics (SGL) Control was then transferred to Khronos Group Introduction.
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.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
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.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
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.
Chapter 4 -- Color1 Color Open GL Chapter 4. Chapter 4 -- Color2 n The goal of almost all OpenGL applications is to draw color pictures in a window on.
Chapter 13 Special Visual Techniques. Blending ◦ Without blending, a source fragment’s color values are supposed to overwrite those of its destination.
1 Computer Graphics Week11 : Hidden Surface Removal.
Compositing and Blending Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Computer Graphics I, Fall 2008 Compositing and Blending.
Chapter 6. Blending, Antialiasing, Fog, and Polygon Offset Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
Week 7 - Monday CS361.
Draw a Simple Object.
Introduction to Computer Graphics with WebGL
Week 2 - Friday CS361.
Computer Graphics Lecture 32
Visual Appearance Chapter 4
Deferred Lighting.
The Graphics Rendering Pipeline
I = a I + ( ) 1 – a I BLENDING, ANTIALIASING, AND FOG l l 1 l 2 Earth
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Display Lists & Text Glenn G. Chappell
blending blending textures reflection fog
UMBC Graphics for Games
Lecture 13 Clipping & Scan Conversion
Introduction to Meshes
Computer Graphics Practical Lesson 7
Computer Graphics 4Practical Lesson
Chapter X Output Merger.
blending blending textures reflection fog
Introduction to Meshes
Presentation transcript:

Lecture 12 Blending, Anti-aliasing, Fog, Display Lists

Blending Alpha value: It’s been ignored so far. We use alpha value for blending. Fragments: After the rasterization stage (including texturing and fog), the data are not yet pixels. At this stage, they are called fragments.(These are called source) Pixels: Then each fragment undergoes a series of tests and operations after which, it is called a pixel.(These are called destination) Blending: Specifies a blending function that combines color values from a source and a destination

Blending Function Blending Function: Specifies how source and destination are blended together. Final result of combination for each pixel is calculated from the following formula: (Rs.Sr+Rd.Dr, Gs.Sg+Gd.Dg, Bs.Sb+Bd.Db, As.Sa+Ad.Da) glBlendFunc(Glenum sfactor, Glenum dfactor)

Blending Coefficients Table

Samples of Blending Draw two images blending together equally: – Source: GL_SRC_ALPHA – Destination: GL_ONE_MINUS_SRC_ALPHA – Draw the source with alpha=0.5 Draw three images blending together equally: – Set the destination factor to GL_ONE – Set the source factor to GL_SRC_ALPHA – Draw each of the images with an alpha equal to Need more? Refer to the RedBook, Chapter 6, “Sample Uses of Blending”

Anti-aliasing

Solution Use Coverage values and Alpha

Enabling Anti-alias glEnable(GL_POINT_SMOOTH) glEnable(GL_LINE_SMOOTH) You may want to optimize anti-aliasing: – Use glHint() along with the parameters. – Use blending when two lines cross each other – Use GL_SRC_ALPHA (source) and GL_ONE_MINUS_SRC_ALPHA (destination). – You can use GL_ONE for the destination factor to make lines a little brighter where they intersect

Anti-aliasing Polygons

Use glEnable(GL_POLYGON_SMOOTH ): This will cause pixels on the edges of the polygon to be assigned fractional alpha values based on their coverage. Turn off the depth buffer set the blending factors to GL_SRC_ALPHA_SATURATE (source) and GL_ONE (destination) Sort all the polygons in your scene so that they're ordered from front to back before drawing them

Fog Makes objects fade into the distance. Fog is a general term that describes forms of atmospheric effects. Fog can be used to simulate haze, mist, smoke, or pollution.

Using Fog glEnable(GL_FOG) Use Fog equation Use Fog color glFog{if}(GLenum pname, TYPE param)

Using Fog

Display Lists Advantages of using Display Lists: – Store OpenGL commands for later execution – Using display lists, you can define the geometry and/or state changes once and execute them multiple times. – Saves lots of resources when an OpenGL program is running over a network.(Saves lots of back and forth communications)

Using Display Lists Use glGenLists(size) to create names. Use glNewList(name, GL_COMPILE/GL_EXECUTE/GL_COMPILE_AND EXECUTE), glEndList() to define a list Use glCallList(list_name) to recall a list.

Limitations Only the values for expressions are stored in the list Not the expressions. Example: GLfloat color_vector[3] = {0.0, 0.0, 0.0}; glNewList(1, GL_COMPILE); glColor3fv(color_vector); glEndList(); color_vector[0] = 1.0; The color is not changed in the list after the last line is executed.

Limitations The following commands are not stored in a display list: Commands that set client state. Commands that retrieve state values aren't stored in a display list.

Hierarchical Display Lists A hierarchical display list is allowed in OpenGL, which is a display list that executes another display list. Example: glNewList(listIndex,GL_COMPILE); glCallList(handlebars); glCallList(frame); glTranslatef(1.0,0.0,0.0); glCallList(wheel); glTranslatef(3.0,0.0,0.0); glCallList(wheel); glEndList();

END