Tuesday, 3 July 2012

Generic XNA - Fire 2D & 3D Shaders

Well, this should be the final post on these flame shaders. As you have seen in the previous posts I have created 2D and 3D flame shaders based on the flame shader that comes with the NVIDIA SDK. When I initially created the 2D shader I found there was an issue with it when drawn with the 3D effect, turns out the issue was in the FireEmitterBase class, it was fixed by me setting the effect save state in the Begin call. Once that was done it all rendered fine.

The only issue with the 2D flame shader is that you have to make a draw call per flame as an index.offset has to be passed per flame or the flame animations will all look the same.

I have put them all in the same project, just added a new class for the 2D flame, as well as the shader it's self and a floor class.

Solution can be found here.


  1. this is very interesting, i would like to try it, but the link seems to be broken.

    Currently i'm work on a project that involves fire effects, and this would be a great add-on.

    So, i would like to ask you, if exist other place which i could get the code.

    Thanks in advance.

    1. Hi JT, ill try and get the link fixed this week, if by Wednesday it's still not working, post here again to remind me :)

  2. Wow, this looks very well too! Your site owns a fav+ in the browser of mine!