Click here to Skip to main content
15,878,970 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.1K   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 Pin
Still Dont Know30-Apr-03 17:29
sussStill Dont Know30-Apr-03 17:29 
GeneralRe: Memory Leak Pin
dswigger1-May-03 2:46
dswigger1-May-03 2:46 
GeneralRe: Memory Leak Pin
dswigger1-May-03 2:48
dswigger1-May-03 2:48 
GeneralRe: Memory Leak Pin
Adam °Wimsatt8-May-03 7:39
Adam °Wimsatt8-May-03 7:39 
GeneralRe: Memory Leak Pin
Adam °Wimsatt8-May-03 8:10
Adam °Wimsatt8-May-03 8:10 
GeneralRe: Memory Leak Pin
cK120-Feb-04 10:43
cK120-Feb-04 10:43 
GeneralRe: Memory Leak Pin
oliver_lion22-Oct-05 7:06
oliver_lion22-Oct-05 7:06 
GeneralAnother bug fix Pin
oliver_lion22-Oct-05 7:32
oliver_lion22-Oct-05 7:32 
GeneralRe: Memory Leak Pin
__jda__14-Nov-06 4:48
__jda__14-Nov-06 4:48 
GeneralIs there a chance to render the fire effect to a black instead of a red background Pin
cyberian0121-Apr-03 7:51
cyberian0121-Apr-03 7:51 
GeneralComplie error Pin
cjv21426-Mar-03 21:23
cjv21426-Mar-03 21:23 
GeneralRe: Complie error Pin
So1o2-Apr-03 20:26
So1o2-Apr-03 20:26 
QuestionIs it modifiable the efficiency of the fire effect? Pin
seyoung pyo24-Mar-03 21:26
seyoung pyo24-Mar-03 21:26 
GeneralOptimization for water Pin
John R. Shaw7-Mar-03 9:51
John R. Shaw7-Mar-03 9:51 
GeneralEffect on Title Bar Pin
Paras31-Jan-03 18:01
Paras31-Jan-03 18:01 
GeneralRe: Effect on Title Bar Pin
tetsuoii24-Feb-03 12:14
tetsuoii24-Feb-03 12:14 
GeneralC# or VB.NET version Pin
Hasse27-Nov-02 9:34
Hasse27-Nov-02 9:34 
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 

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.