Click here to Skip to main content
15,881,248 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.3K   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: C# or VB.NET version Pin
dswigger29-Nov-02 15:50
dswigger29-Nov-02 15:50 
GeneralRe: C# or VB.NET version Pin
Anthony_Yio5-Jan-03 20:49
Anthony_Yio5-Jan-03 20:49 
GeneralCircles / Ellipses Pin
Greg Francois7-Oct-02 5:49
Greg Francois7-Oct-02 5:49 
GeneralRe: Circles / Ellipses Pin
dswigger29-Nov-02 15:51
dswigger29-Nov-02 15:51 
GeneralFlippin eck.. Pin
adamUK4-Sep-02 9:54
adamUK4-Sep-02 9:54 
GeneralOh.. very interesting item Pin
imanoos29-Aug-02 22:19
imanoos29-Aug-02 22:19 
QuestionHow could you get this to work in a MFC project Pin
Anonymous7-Aug-02 12:33
Anonymous7-Aug-02 12:33 
AnswerRe: How could you get this to work in a MFC project Pin
dswigger7-Aug-02 13:09
dswigger7-Aug-02 13:09 
Well you could compile just the effects classes and simply include their h files...They do not use any resources.
Question,Help me:how can i make OilPaint effect? Pin
Morice30-Jul-02 22:37
Morice30-Jul-02 22:37 
AnswerRe: ,Help me:how can i make OilPaint effect? Pin
dswigger31-Jul-02 3:14
dswigger31-Jul-02 3:14 
AnswerRe: ,Help me:how can i make OilPaint effect? Pin
Aeroba12-Jun-03 22:10
Aeroba12-Jun-03 22:10 
GeneralRe: ,Help me:how can i make OilPaint effect? Pin
dswigger13-Jun-03 2:07
dswigger13-Jun-03 2:07 
GeneralCan't get the crrect image Pin
Anonymous30-Jul-02 4:46
Anonymous30-Jul-02 4:46 
GeneralRe: Can't get the crrect image Pin
dswigger30-Jul-02 5:11
dswigger30-Jul-02 5:11 
GeneralRe: Can't get the crrect image Pin
Anonymous30-Jul-02 15:51
Anonymous30-Jul-02 15:51 
GeneralRe: Can't get the crrect image Pin
Anonymous30-Jul-02 21:46
Anonymous30-Jul-02 21:46 
GeneralRe: Can't get the crrect image Pin
frAgor26-Aug-03 15:59
frAgor26-Aug-03 15:59 
GeneralQuery Regarding ActiveX Porting... Pin
Thanos Naranja29-Jul-02 12:37
Thanos Naranja29-Jul-02 12:37 
GeneralRe: Query Regarding ActiveX Porting... Pin
dswigger30-Jul-02 2:24
dswigger30-Jul-02 2:24 
GeneralRe: Query Regarding ActiveX Porting... Pin
Thanos Naranja3-Aug-02 16:17
Thanos Naranja3-Aug-02 16:17 
GeneralRe: Query Regarding ActiveX Porting... Pin
dswigger5-Aug-02 3:25
dswigger5-Aug-02 3:25 
GeneralA couple of bugs... Pin
Henry P.6-Jul-02 12:03
Henry P.6-Jul-02 12:03 
GeneralRe: A couple of bugs... Pin
dswigger8-Jul-02 2:33
dswigger8-Jul-02 2:33 
GeneralRe: A couple of bugs... Pin
Henry P.8-Jul-02 18:24
Henry P.8-Jul-02 18:24 
GeneralMemory Leak Pin
31-May-02 5:54
suss31-May-02 5:54 

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.