Transparency - PowerPoint PPT Presentation

About This Presentation
Title:

Transparency

Description:

Blending Alphas. Transparent back color with opacity ab. Transparent front color with opacity af ... Alpha Channel. Value between 0 and 1. Combined partial ... – PowerPoint PPT presentation

Number of Views:69
Avg rating:3.0/5.0
Slides: 15
Provided by: hanwe3
Category:

less

Transcript and Presenter's Notes

Title: Transparency


1
Transparency
- Blending colors
- Frame buffer limitations
- Compositing
2
Basic Alpha Blending
Transparent front color with opacity a
Solid back color
3
Basic Alpha Blending
Transparent front color with opacity a
Solid back color
2
1
3
4
Blending Alphas
Transparent back color with opacity ab
Transparent front color with opacity af
Process in either front to back or back to front
order But cant insert surface between them later
- why?
5
Premultiply alpha
Transparent back color with opacity ab
Transparent front color with opacity af
Notice - rgb always appears multiplied by its
a Can store rgbs as premultiplied by a
6
Frame Buffer
- What about z value in depth buffer?
  • Manage z-values glDepthMask(GL_FALSE)

7
Transparency in OpenGL
glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA,GL_ON
E_MINUS_SRC_ALPHA) Draw polygon that has alpha
values set glDisable(GL_BLEND)
8
Screendoor transparency
- No blend - use alternating pixels from
different surfaces
What about z value in depth buffer?
9
Stipple in OpenGL
Uses 32x32 pattern
  • GLubyte halftone
  • 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55 , 0x55
  • repeat 16 lines

glEnable(GL_POLYGON_STIPPLE) glPolygonStipple(hal
ftone) draw polygon glDisable(GL_POLYGON_STIPPL
E)
10
Compositing
  • Without pixel z values
  • With pixel z
  • - use depth at pixel corners to interpolate
    partial coverage

11
Compositing
  • Z buffer keep z values with color buffer
  • Compare z values at corresponding pixels
  • Keep all or nothing

12
Compositing
  • Z buffer keep z values with color buffer
  • Compare z values at corresponding pixels
  • 2. Compute partial coverage
  • Interpolate corner z values
  • Compare corner values for pixel and blend

13
Compositing
Alpha Channel Value between 0 and 1 Combined
partial coverage and transparency
Computed during rendering in front of a null
background
2 1/2 D blend based on alpha of image in front
alpha
RGB
32 bit pixel values
14
Compositing - example
Write a Comment
User Comments (0)
About PowerShow.com