Ashes! Ashes! We all fall down!
Inspiration
Typically in a high heat situation you see a lot of embers buzzing around. Sometimes if the material that is being lit is very light i.e. paper, leaves, volcanic ash, etc will take to the air before it's fully lit. I've made plenty of embers before but I wanted to try to replicate this effect in UDK. As an extra challenge I didn't want to allow myself to use alpha cutout plug.Shader Overview
Entire Burning Particles Shader |
Three Parts
I wanted to have a texture that was going to be slowly eaten away by heat. To me that meant having three parts to the texture. An unscathed portion that heat hasn't gotten to yet, a burning portion that is still hot, and finally a burned portion that has already burned off.Burn Erosion
Burn Erosion Portion |
My solution to this was using an if statement. If my [Texture Value - Opacty Value < Opacity Value] then those pixels were given an eroded (tex val - opacity val) value other wise the pixels were unchanged. It's a little confusing in the shader since i do a 1 minus operation to make both sides of my comparison increasing or decreasing at the same time. Without the one minus the if statement would always be false (Yes, this can be further cleaned up).
The rotator above is just to give some more randomness to the particles along with the standard contrast and brightness adjustments. I also added an inversion option at the end.
Colorizing
Color Mask |
I invert the output from my burn erosion to create a mask. Originally the parts that were completely opaque had a value of one but once I invert them they go to zero. This allows me to add in to those zero parts the value of my texture sample. I colorize the remainder of the mask by multiplying by my vertex color. This gives us our two remaining parts of the embers.
That other arrow you see going into a multiply is to make the burning portion flicker. It's a trick I learned from one of Bill Klidas's tutorials. It's a hack but gives you an easy way to make it appear as if the embers are flickering randomly
Flickering |