Click here to Skip to main content
15,881,559 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

 
QuestionCool,Vote of 10~ Pin
Jason.LYJ5-Sep-13 19:26
professionalJason.LYJ5-Sep-13 19:26 
QuestionHi,How to support 16bit depth use SpecialFX? Pin
gmmylose200930-Nov-09 0:49
gmmylose200930-Nov-09 0:49 
GeneralDLL Please Pin
Mustafa Magdy13-Oct-09 3:37
Mustafa Magdy13-Oct-09 3:37 
GeneralWrote an MFC CStatic wrappper for these cool effects :) Pin
Hou Tianze13-Jul-09 20:45
Hou Tianze13-Jul-09 20:45 
Questiondoes anyone have a version without memory leaks? Pin
sfgasdfas@asdfasdf.it5-Oct-08 22:18
sfgasdfas@asdfasdf.it5-Oct-08 22:18 
Questionanyone has a version without the problem of the buffer overrun? Pin
asdf34asdf4-Jun-08 22:34
asdf34asdf4-Jun-08 22:34 
GeneralC# or VB Pin
Johnny J.22-Jan-08 4:28
professionalJohnny J.22-Jan-08 4:28 
GeneralRe: C# or VB Pin
dswigger22-Jan-08 8:30
dswigger22-Jan-08 8:30 
GeneralThank you for your share! Pin
Member 404584111-Dec-07 20:17
Member 404584111-Dec-07 20:17 
GeneralAnother memory leak Pin
mbw3303-Sep-07 17:14
mbw3303-Sep-07 17:14 
Generalfatal error Pin
alaa naeem22-Aug-07 21:10
alaa naeem22-Aug-07 21:10 
GeneralRe: fatal error Pin
asdf34asdf4-Jun-08 21:42
asdf34asdf4-Jun-08 21:42 
QuestionWhy so complicated??? Pin
Christopher Stratmann22-Aug-06 9:37
Christopher Stratmann22-Aug-06 9:37 
AnswerRe: Why so complicated??? Pin
Waldermort14-Sep-06 5:46
Waldermort14-Sep-06 5:46 
GeneralRe: Why so complicated??? PinPopular
dswigger22-Jan-08 8:46
dswigger22-Jan-08 8:46 
GeneralWater effect Pin
nzembs3-Dec-05 13:21
nzembs3-Dec-05 13:21 
GeneralDLL Pin
Roland8315-Oct-05 7:10
Roland8315-Oct-05 7:10 
GeneralTwo bitmaps Pin
st0per3-Jul-04 15:30
st0per3-Jul-04 15:30 
GeneralRe: Two bitmaps Pin
14-Sep-05 15:35
suss14-Sep-05 15:35 
GeneralWater Error Pin
SilentDragonz20-Apr-04 16:11
SilentDragonz20-Apr-04 16:11 
GeneralRe: Water Error Pin
dswigger21-Apr-04 7:18
dswigger21-Apr-04 7:18 
GeneralRe: Water Error Pin
C.Young @ XiCabin9-Dec-05 21:05
C.Young @ XiCabin9-Dec-05 21:05 
GeneralRe: Water Error Pin
ebia.tty024-May-06 4:09
ebia.tty024-May-06 4:09 
use sqrtl cosl ..is work..;P
GeneralAbout the water effect Pin
caucy20-Apr-04 14:38
caucy20-Apr-04 14:38 
GeneralRe: About the water effect Pin
dswigger21-Apr-04 7:21
dswigger21-Apr-04 7:21 

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.