OpenGL Blending Akbar Ali

Slides:



Advertisements
Similar presentations
Modular Design Using Subroutines (functions later)
Advertisements

POST-PROCESSING SET09115 Intro Graphics Programming.
Compositing and Blending Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics.
OpenGL Fragment Operations
Graphics Pipeline.
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.
1 Buffers and Processing Fragments 2011 Autumn Animação e Visualização Tridimensional 2011/2012.
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.
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
CHAPTER 10 Alpha Blending and Fog © 2008 Cengage Learning EMEA.
Internet Vision - Lecture 3 Tamara Berg Sept 10. New Lecture Time Mondays 10:00am-12:30pm in 2311 Monday (9/15) we will have a general Computer Vision.
Chapter 6. More on Color and Material Presented by Garrett Yeh.
Six compound procedures and higher-order procedures.
7/2/2006Based on: Angel (4th Edition) & Akeine-Möller & Haines (2nd Edition)1 CSC345: Advanced Graphics & Virtual Environments Lecture 4: Visual Appearance.
Non-Photorealistic Rendering - This is the attempt to make a realistic scene or object look as if it were hand drawn.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Geometric Objects and Transformations. Coordinate systems rial.html.
CS324e - Elements of Graphics and Visualization Compositing.
Google Adsense Tips and Tricks.... Every single website and its owner have the opportunity to make some great money by displaying Google Adsense ads on.
Informationsteknologi Monday, November 26, 2007Computer Graphics - Class 121 Today’s class Drawing lines Bresenham’s algorithm Compositing Polygon filling.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Lecture 12 Blending, Anti-aliasing, Fog, Display Lists.
December 8, 2003Other ISA's1 Other ISAs Next, we discuss some alternative instruction set designs. – Different ways of specifying memory addresses – Different.
DREAM PLAN IDEA IMPLEMENTATION Introduction to Computer Graphics Dr. Kourosh Kiani
 HTML is hypertext markup language. It is a way for people to display their information with more complex pictures and text displays. Before HTML, messages.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
More on Environment Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, December 10, 2003.
CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee.
Particle Systems (Motion Machines of 2D Objects with Textures) Matthew K. Bowles Advanced Computer Graphics Spring 2004.
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.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
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.
Improving the appearance of 3D OpenGL scenes
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.
Dividing Polynomials. First divide 3 into 6 or x into x 2 Now divide 3 into 5 or x into 11x Long Division If the divisor has more than one term, perform.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
Warm Up If you add two even numbers do you always get an even number? If you add two odd numbers do you always get an odd number.
Photoshop – Filters Computer Information Technology Section 7-9.
Compositing and Blending Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Divide large numbers Example 639 ÷ 3 Set out the working like this: 3 2 Then the tens Start with the hundreds 639 ÷ 3 = ÷ 3 = 1 6 ÷ 3 = 2.
Computer Graphics I, Fall 2008 Compositing and Blending.
How to use Cc and Bcc in your s.
An Introduction to VEX IQ Programming with Modkit
Draw a Simple Object.
Introduction to Computer Graphics with WebGL
Deferred Lighting.
The Graphics Rendering Pipeline
I = a I + ( ) 1 – a I BLENDING, ANTIALIASING, AND FOG l l 1 l 2 Earth
Reflections from Bumpy Surfaces
Making the Applications Interesting
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Geb Thomas Adapted from the OpenGL Programming Guide
Other ISAs Next, we’ll first we look at a longer example program, starting with some C code and translating it into our assembly language. Then we discuss.
Computer Graphics Practical Lesson 7
Addressing mode summary
Chapter X Output Merger.
Dividing Polynomials.
Frame Buffers Fall 2018 CS480/680.
Presentation transcript:

OpenGL Blending Akbar Ali

Blending Adds realistic effects to your scenes Gives you the ability to promote volume fog. Permits you to blend many textures on top of others using certain state calls and variables.

Blending? Usually this occurs when the alpha value is combined with the color value of the fragment that is already on the screen(framebuffer). When this occurs this is what we call blending. Usually it is preferred to use the alpha channel when enabling blending. So say bye-bye to your a lot of your old textures.

Enabling Blending & Disabling Blending glEnable(GL_BLEND) & glDisable(GL_BLEND)

How the Blending is processed With glBlendFunc(GLEnum sfactor, GLEnum dfactor) sfactor is the source factor dfactor is the destination factor

What this means to OpenGL Gives it the needed data so it knows how to process the pixels accordingly. Virtual machine then applies these changes and then makes all future computations accordingly according to the mode which you are in.

sfactor glBlendFunc sfactor glBlendFunc(Glenum sfactor, Glenum dfactor) This is your source factor, OpenGL will look at these and the mode you set them in apply them to the function and Walla you have your blending. Below is the settings you can put them in and what they do accordingly. Ps-> the destination is the pixels that are already on the screen(frame buffer). The source are the ones on there way to the framebuffer. Blending factors are clamped to the range [0,1].These are the most common ones used, if you would like to see more please consult the ‘what’s next section’ When the ^d, ^s, ^c, comes up that just means that it is inherit those colors which are already present. Destination; Source; Constant. sfactor ConstantsBlend Factor GL_DST_COLORR^d, G^d, B^d, A^d GL_ONE_MINUS_DST_COLOR(1,1,1,1)-(R^d,G^d,B^d,A^d) GL_ONE_MINUE_SRC_ALPHA(1,1,1,1)-(A^s,A^s,A^s,A^s)

dfactor glBlendFunc dfactor glBlendFunc(Glenum sfactor, Glenum dfactor) dfactor ConstantsBlend Factor GL_ONE_MINUS_DST_ALPHA(1,1,1,1)-(A^d,A^d,A^d,A^d) GL_ONE_MINUS_SRC_ALPHA(1,1,1,1)-(R^s,G^s,B^s,A^s)

Practice, Practice,Practice. When learning these blending modes you are going to have to practice these and check out there effects. The only advice is to just try all the different constants and experiment. In no time you will be achieving some nice translucent glass effects etc. Here is an insert of some code glEnable(GL_BLEND); /* don’t forget to enable the mode*/ glEnable(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUE_SRC_ALPHA); draw_texture_polygon ();/* this should be something like a cube which is textured it is really easy to see the effects then*/ glDisable(GL_BLEND); /*disable this or then all your textures planes etc. Will be effected by this */

OpenGL Blending This in it self could have a whole book dedicated to it. Many amazing effects can be achieved by using this effectively. A few are Weapon effects Portals (real portals like the ones you use when warping. Distortion Particle Effects

Check this out Look through the manual at OpenGL.org over OpenGL and it should contain a write- up of all the constants that you can specify when using blending. If time permits I will copy it and post it on the white paper.