Click here to Skip to main content
15,885,366 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 551.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

 
GeneralRe: Memory Leak.. I did it. Pin
dswigger6-Jun-02 10:41
dswigger6-Jun-02 10:41 
GeneralRe: Memory Leak Pin
John R. Shaw7-Mar-03 9:40
John R. Shaw7-Mar-03 9:40 
GeneralRe: Memory Leak Pin
John R. Shaw7-Mar-03 10:48
John R. Shaw7-Mar-03 10:48 
GeneralPoor Bob Pin
Jon Newman12-Apr-02 10:50
Jon Newman12-Apr-02 10:50 
GeneralRe: Poor Bob Pin
Brian Delahunty23-Jun-02 5:17
Brian Delahunty23-Jun-02 5:17 
Generalread bitmap from a file, and then show effects Pin
shokisingh19-Mar-02 22:11
shokisingh19-Mar-02 22:11 
GeneralRe: read bitmap from a file, and then show effects Pin
dswigger20-Mar-02 2:11
dswigger20-Mar-02 2:11 
GeneralRe: read bitmap from a file, and then show effects Pin
shokisingh21-Mar-02 1:24
shokisingh21-Mar-02 1:24 
GeneralRe: read bitmap from a file, and then show effects Pin
Anonymous7-Oct-02 14:39
Anonymous7-Oct-02 14:39 
GeneralI really like the water effect.. Pin
alex.barylski5-Mar-02 16:16
alex.barylski5-Mar-02 16:16 
GeneralRe: I really like the water effect.. Pin
Jon Newman12-Apr-02 10:46
Jon Newman12-Apr-02 10:46 
GeneralGreat effect but im having a bit of difficulty... Pin
LiquidKnight2-Mar-02 9:57
LiquidKnight2-Mar-02 9:57 
GeneralWater..... FIRE! Pin
1-Mar-02 8:15
suss1-Mar-02 8:15 
GeneralWhere can I get similar FX for Page Flipping Pin
Tili17-Dec-01 7:34
Tili17-Dec-01 7:34 
GeneralNo words Pin
Jose Manuel Muélledes30-Aug-01 9:17
Jose Manuel Muélledes30-Aug-01 9:17 
GeneralText "CodeProject" disappears after 25 seconds Pin
29-Aug-01 19:25
suss29-Aug-01 19:25 
GeneralRe: Text Pin
dswigger30-Aug-01 0:05
dswigger30-Aug-01 0:05 
GeneralRe: Text Pin
30-Aug-01 3:21
suss30-Aug-01 3:21 
GeneralIt takes 100% CPU time Pin
27-Aug-01 2:11
suss27-Aug-01 2:11 
GeneralRe: It takes 100% CPU time Pin
dswigger30-Aug-01 11:07
dswigger30-Aug-01 11:07 
GeneralThanks a lot! Pin
Jeason Zhao26-Aug-01 15:26
Jeason Zhao26-Aug-01 15:26 
GeneralGreat Pin
Rubén23-Aug-01 20:57
Rubén23-Aug-01 20:57 
Generalvery cool Pin
23-Aug-01 17:42
suss23-Aug-01 17:42 
GeneralAnything else cool... Pin
Darren Schroeder23-Aug-01 12:09
Darren Schroeder23-Aug-01 12:09 
GeneralRe: Anything else cool... Pin
dswigger23-Aug-01 12:33
dswigger23-Aug-01 12:33 

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.