The document summarizes a lecture on blending, compositing, and anti-aliasing in computer graphics. It discusses how colors are combined during rendering using blending operations, and how compositing operates on entire images rather than individual pixels. Porter-Duff models for digital image compositing are explained, along with how they relate to OpenGL blending functions.
1. CS 354 Blending, Compositing, Anti-aliasing Mark Kilgard University of Texas February 14, 2012
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13. A Simplified Graphics Pipeline Application Vertex batching & assembly Triangle assembly Triangle clipping Triangle rasterization Fragment shading Depth testing Color update/blending Application- OpenGL API boundary Framebuffer NDC to window space Depth buffer Re-examine framebuffer color update…
14. A few more steps expanded Application Vertex batching & assembly Lighting View frustum clipping Triangle rasterization Fragment shading Depth testing Color update/blending Application- OpenGL API boundary Framebuffer NDC to window space Depth buffer Vertex transformation User defined clipping Back face culling Perspective divide Triangle assembly Texture coordinate generation
15.
16. Blending Enabled vs. Disabled pixel color fragment color blend operation pixel color fragment color glDisable ( GL_BLEND ) glEnable ( GL_BLEND )
17.
18.
19. Why blending? compositing window systems volumetric effects; explosions medical imaging compositing complex art work
20. Conventional Blend Operation source color destination factor destination color source factor × × + clamp [0,1] pixel color fragment color
21. Conventional Blend Operation source color destination factor destination color source factor × × + clamp [0,1] pixel color fragment color × × × + + + × × × clamp [0,1] clamp [0,1] clamp [0,1] modulate, add, and clamp operations are vector on RGBA components
22. Conventional Blend Operation source color destination factor destination color source factor × × + clamp [0,1] pixel color fragment color glBlendFunc ( srcFunc , dstFunc )
23. Blend Function Parameters where s = min(A s ,1-A d ) (s,s,s,s) GL_SRC_ALPHA_SATURATE (1-A c ,1-A c ,1-A c ,1-A c ) GL_ONE_MINUS_CONSTANT_ALPHA (A c ,A c ,A c ,A c ) GL_CONSTANT_ALPHA (1-R c ,1-G c ,1-B c ,1-A c ) GL_ONE_MINUS_CONSTANT_COLOR (R c ,G c ,B c ,A c ) GL_CONSTANT_COLOR (1-A d ,1-A d ,1-A d ,1-A d ) GL_ONE_MINUS_DST_ALPHA (A d ,A d ,A d ,A d ) GL_DST_ALPHA (1-A s ,1-A s ,1-A s ,1-A s ) GL_ONE_MINUS_SRC_ALPHA (A s ,A s ,A s ,A s ) GL_SRC_ALPHA (1-R d ,1-G d ,1-B d ,1-A d ) GL_ONE_MINUS_DST_COLOR (R d ,G d ,B d ,A d ) GL_DST_COLOR (1-R s ,1-G s ,1-B s ,1-A s ) GL_ONE_MINUS_SRC_COLOR (R s ,G s ,B s ,A s ) GL_SRC_COLOR (1,1,1,1) GL_ONE (0,0,0,0) GL_ZERO ( f r , f g , f b , f a ) Parameter
24.
25.
26.
27.
28.
29.
30.
31. Blend Color for Factors source color destination factor destination color source factor × × + clamp [0,1] pixel color fragment color glBlendColor (r,g,b,a) blend color
32. Min/Max Blend Operation source color destination color min or max clamp [0,1] pixel color fragment color glBlendEquation ( GL_MIN ) glBlendEquation ( GL_MAX )