Click here to Skip to main content
15,867,453 members
Articles / Desktop Programming / MFC
Article

Really cool visual FX

Rate me:
Please Sign up or sign in to vote.
4.92/5 (116 votes)
20 Aug 20012 min read 549.8K   12.2K   210   126
A set of classes for doing stunning visual effects, including water, plasma and fire.

Sample Image

The Code Project is on FIRE!

This project has a set of 3 classes that will let you add some pretty cool looking effects (real-time) to images/dibs.

Again (as with my wave editor control) I pulled these out of my code archive, dusted them off, and made a little project that some people might find useful. ie: I did not document much at all.

After running the demo click on the 'Animate' button. Then move your mouse across the image, click, then play with the other settings. The sliders are used to change the alpha (transparency) of the plasma and fire effects. You have to release the slider for the alpha change to take effect.

You generally see these effects used in real-time demos, which is where I culled most of the source from and converted it into a more object oriented class design. I was originally going to use them as the basis for a series of VIS type plugins to be used in an audio application. As commonly happens that project sort of went to the wayside.

I included the CDibSectionLite class created by Chris Maunder in the project just so I had something to render onto/with. The effects expect all data to be 32bit depth image data.

CWaterRoutine
- Renders the real popular water effect
CFireRoutine
- Renders simulated fire
CPlasmaRoutine
- Renders real-time plasmas

By looking at the code for these effects you should notice they are all based around the idea of using a separate filter to achieve their results. If you have never looked at the water code (for example) you will be amazed at how such simple routines can create such a wonderful effect. Same goes with the plasma and the fire. Try playing around with some of the data members - you can do a LOT more than what my sample application allows.

The animation is achieved with a simple windows timer. The only notable thing about it is the way I chained the effects together, by rendering one on top of another.

You are free to use the code as you wish, just drop me an email if you use it in something interesting, extend it, want to complain about my lack of documentation (again), or just want to say "hey!".

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRight way up Pin
fantastic_mr_fox22-Aug-01 22:54
fantastic_mr_fox22-Aug-01 22:54 
GeneralRe: Right way up Pin
Patrick Hoffmann26-Aug-01 4:34
Patrick Hoffmann26-Aug-01 4:34 
GeneralRe: Right way up - white appearing fix Pin
st0per3-Jul-04 15:09
st0per3-Jul-04 15:09 
GeneralLet me guess your age. Pin
Christian Skovdal Andersen22-Aug-01 8:52
Christian Skovdal Andersen22-Aug-01 8:52 
GeneralRe: Let me guess your age. Pin
dswigger22-Aug-01 9:21
dswigger22-Aug-01 9:21 
GeneralRe: Let me guess your age. Pin
Christian Skovdal Andersen22-Aug-01 9:23
Christian Skovdal Andersen22-Aug-01 9:23 
GeneralRe: Let me guess your age. Pin
dswigger22-Aug-01 9:40
dswigger22-Aug-01 9:40 
Generalmemory leaks Pin
Patrick Hoffmann22-Aug-01 1:27
Patrick Hoffmann22-Aug-01 1:27 
GeneralRe: memory leaks Pin
Patrick Hoffmann22-Aug-01 2:40
Patrick Hoffmann22-Aug-01 2:40 
GeneralRe: memory leaks Pin
Patrick Hoffmann22-Aug-01 3:10
Patrick Hoffmann22-Aug-01 3:10 
GeneralRe: memory leaks Pin
Konstantin Boukreev22-Aug-01 3:40
Konstantin Boukreev22-Aug-01 3:40 
GeneralRe: memory leaks Pin
Chris Maunder24-Aug-01 22:33
cofounderChris Maunder24-Aug-01 22:33 
GeneralThis is *very* sexy Pin
Christian Graus21-Aug-01 12:44
protectorChristian Graus21-Aug-01 12:44 
GeneralRe: This is *very* sexy Pin
Jason De Arte21-Aug-01 14:43
Jason De Arte21-Aug-01 14:43 
GeneralRe: This is *very* sexy Pin
Christian Graus21-Aug-01 14:47
protectorChristian Graus21-Aug-01 14:47 
GeneralRe: This is *very* sexy Pin
Paul Selormey25-Aug-01 19:52
Paul Selormey25-Aug-01 19:52 
GeneralRe: This is *very* sexy Pin
Christian Graus26-Aug-01 3:00
protectorChristian Graus26-Aug-01 3:00 
GeneralRe: This is *very* sexy Pin
Paul Selormey26-Aug-01 15:22
Paul Selormey26-Aug-01 15:22 
GeneralRe: This is *very* sexy Pin
Christian Graus26-Aug-01 15:30
protectorChristian Graus26-Aug-01 15:30 
GeneralRe: This is *very* sexy Pin
dswigger26-Aug-01 17:37
dswigger26-Aug-01 17:37 
GeneralRe: This is *very* sexy Pin
Alex Taylor26-Aug-01 17:54
Alex Taylor26-Aug-01 17:54 
GeneralRe: This is *very* sexy Pin
Paul Selormey27-Aug-01 1:16
Paul Selormey27-Aug-01 1:16 
GeneralAUTOBUILDCOUNT_H Pin
Patrick Hoffmann21-Aug-01 1:17
Patrick Hoffmann21-Aug-01 1:17 
GeneralRe: AUTOBUILDCOUNT_H Pin
Uwe Keim21-Aug-01 3:33
sitebuilderUwe Keim21-Aug-01 3:33 
GeneralRe: AUTOBUILDCOUNT_H Pin
Patrick Hoffmann21-Aug-01 3:48
Patrick Hoffmann21-Aug-01 3:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.