It has come to the time in my game where my mind turns towards … explosions.
Here’s an explosion I created in Blender Game Engine a year or so ago:
Just some crossed planes, rotations, scalings, and additive alpha materials with an animation on the color. It even looks OK when intersecting with other objects!
I want to do something similar in Playcanvas. Generating some planes is easy enough, as is mapping a texture to them. The hard part is getting them to fade out.
In blender, there is a property called ‘object color.’ You can animate it and blend it into the the texture. It allows per-object texture animation as opposed to per-material. Couple this with additive alpha (fading the texture to black), and you can create an nice glowing, fading out explosion.
So how can I animate alpha on a per-object basis in Playcanvas? I can manually generate planes, and create a materail for each explosion, manually fading it out by ramping the opacity every frame, but it seems cumbersome. I’m also not keen to go the sprite route.
So how can I animate the alpha of a material?