![]() |
![]() |
OpenGL Shading Language Tutorials |
Tutorial 7: Color KeyIf you ever programmed in DirectX you probably heard of color keys. Color keying is a very simple method: A certain color (people often used color #FF00FF) is declared transparent. In this example you would just see the circle when it is rendered, the pink will be removed.
Fragment Shader Source
Vertex Shader Source
Exercise: Using colorkeying this way is very problematic. Aliasing effects would make some pink dots still visible. It is better to use an alpha channel for transparency. Implement a vertex and a fragment shader for color keying with alpha channel.
Author: Martin Christen, christen@clockworkcoders.com (source code is included in Tutorial Version 0.2 and higher)
|
|
© 2003 by Martin Christen. All Rights Reserved. |