🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Explosions Redux

Published July 10, 2009
Advertisement
Quite awhile back, in this and this journal entries, I explored generating explosion sprites for animated 2D sprite-based explosions. Recently, I revisited some of that in order to create better, or at least different, looking explosion sprites. Don't get me wrong, in a layered system those generated explosions look good. But I found myself wanting explosions that were a bit more... bumpy, I guess. So I dug out the code, and fiddled.

I decided I wanted something more volumetric. The sprites generated in the above articles are based on 2D, flat "slices" of a 3D function, and in the process of slicing it, depth is lost. I attempt to fake depth by layering different sprites, starting with a large one and working down to smaller ones. Today, I tried something different.

I start with a 3D sphere function as in the previous entries, perturbed using 3 fBm noise functions. I then iterate the pixels of the image as the X and Y axes of the function, and at each step I sample a column along the Z-axis to determine the color of the pixel to output, iteratively stepping along the column until I find a point where the value of the function evaluates to greater than some specified threshold. I tried 2 different methods for calculating the color once I found this 'surface' point.

For the first method, I used the (x,y,z) coordinates themselves, normalized to a unit vector, and performed a dot-product operation with the vector (0,0,1) to generate a value which was then used to interpolate the flame color scale and generate a final color for that pixel. Here is a typical result from this operation:


It has a bit more 'bumpiness' than the previous ones, but to me it still seems sort of flat. So I tried a second method. At each surface point where the function evaluates to greater than threshold, I take the gradient of the 3D function and perform a dot product with (0,0,1) then, as before, use this value to sample a color scale. The results of this operation are very nicely bumpy:




Next up is determing a suitable method for animating the explosion in a realistic manner.
Previous Entry Research
Next Entry Explody
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement