Real-time transparency has become so commonplace in modern games and PC applications that it’s almost taken for granted. However, the specific formula that performs this now-ubiquitous effect is worth understanding.
Transparency is simply a weighted average between the color values of two pixels. As an example, consider the following two colors:
Pure red, or RGB(255, 0, 0)
Pure blue, or RGB(0, 0, 255)
At 50% transparency – or a pure blending between these two colors – we would simply add the individual color amounts together and divide by two. This gives us a new color –
Purple, or RGB(127, 0, 127)
Not entirely surprising, eh?
The effect is certainly more impressive when applied pixel-by-pixel across an entire image, as the downloadable project demonstrates.
DISCLAIMER: These download files are regularly scanned to ensure they remain free from malicious content. Unfortunately, some virus scanners will flag these .zip files as suspicious simply because they contain source code and/or executable files. I have submitted my projects to a number of companies in an attempt to rectify these false-positives. Some have been cooperative. Others have not. If your virus scanner alerts you regarding these files, please allow the file to be submitted for further analysis (if your program allows for that). This should help ensure that any false-positive warnings gradually disappear for all users.
This site - and its many free downloads - are 100% funded by donations. Please consider a small contribution to fund server costs and to help me support my family. Even $1.00 helps. Thank you!