Jump to content
  • Advertisement
  • entries
  • comments
  • views

Fire for teh win

Sign in to follow this  


I've had some success with the additive blended fire effect and have uploaded a video to my YouTube channel showing the effect in motion.


I think it looks really nice and has the right sort of cartoony feel that I was looking for.

I have already discussed the technique but just to recap, I render the fire particles to an offscreen buffer which is all red but with zero alpha, using additive blending but adding the alpha as well as the diffuse.

I then alphablend the pixels from this buffer over the top of the final screen buffer in the final composition shader.

This way you can have additive blended effects over the top of a brightly coloured background at the cost of one extra sample per pixel.

I quickly added a service to the script to create explosions and the video and image above shows three explosions all being triggered by the button. You can set the size of the explosion and also optionally give it a lifetime in seconds, so an explosion with a very short lifetime will look like something blowing up, one with a longer lifetime looks more like something on fire.

The particles are assigned a random direction and speed from the middle. Each particle has a life starting at 1 and reducing to 0 (seconds). Pi multipled by this value and fed into sinf() provides the current size.

I intend to also have a similar flame effect that just uses a different algorithm to control the motion of the particles so that they move upwards and billow outward a random amount, as per this excellent article.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!