Well I’ve spent a few nights now working on Detonator. So far I’ve been getting the feel of the Unity particle system and seeing where its strengths are. Before I go to bed tonight, here’s a little demo scene to kick things off. Nothing parametric yet, but we’ve got to have a nice base effect to work with, right?
Besides the basic particle emitters, there’s a light and a rigidbody explosive force that get spawned. The look is really a first pass, just trying to get all the pieces in. I still need to add chunks flying out with trails, some beams, and get all the particles sorting right. There’s also a bit of flicker between the smoke and other particles that should be worked out. Still, I was happy to see the performance is good even on my old Macbook.
I’ve been thinking about animated textures too. Not sure if they’ll be necessary, but I’d like to try them out. If anyone knows of a tool to convert a movie to a Unity animated texture, let me know. Iterating on that seems like a pain without a good tool.
I wrote a proposal for a parametric explosion system for the Unity Summer of Code… and it was one of four accepted out of over a hundred! I’m excited to be working with Unity engineer Jonas Echterhoff as my mentor – and I’ll definitely need his help. Here’s the announcement: http://blogs.unity3d.com/2009/07/22/unity-summer-of-code-takes-off/
And here’s the proposal:
Great explosions can make a game. Bad explosions can ruin a game. As important as they are, they are difficult to do well because they are composed of art and complex behavior that’s not easily consolidated into a single object. Explosions also have a high degree of randomness, yet within a domain that is not easily described and is often violated.
That said, Unity developers of all types could make great use of a system that allows for efficient creation and iteration of explosion effects.
For artists, the system will provide a means to harness and iterate on complex behavior that is normally hidden behind coding barriers. Artists can think in terms of “size” and “intensity” of the explosion as a whole, while also drilling down to tweak details. Detonator is more than just a collection of particle emitters.
For programmers, creating an explosion with great visual quality will no longer hinge on finding pre-existing particle libraries or an artist friend. Detonator will provide solid results from the start. It will also allow easier binding of game logic to explosion parameters by providing meta-parameters that combine several emitters, models, lights, into a single “Intensity” or “Duration” value.
- Allow non FX-specialists to easily experiment with different looks for their explosions.
- Tie explosion parameters to game events and parameters. ie – have one explosion for damage, one for destruction, all calling the same script but based on remaining hitpoints of the gameobject
- Tie explosion physics to global parameters such as gravity and wind so they can be tweaked and altered at run time in one place.
- Allow the creation of named explosion presets (prefabs) – this will enable code to spawn type of explosion based on incoming weapon
- Create a method where the explosion render complexity scales according to frame rate, total particle count, priority, etc. and provide global and per prefab complexity values for easily tying to code.
- Let the developer decompose the explosion into its component pieces if he wants to use the system as simply a baseline for further art.
As part of the process of building Detonator, we’ll define what an explosion is and create taxonomy for all of its components. The system will consist of 4 layers.
- Layer 0 – The raw gameobjects and scripts
- Layer 1 – Per component parameters
- Layer 2 – Per explosion parameters
- Layer 3 – Detonator System wide parameters
Example Layer 0:
- Particle Emitters
Example Layer 1:
- Flash – A screen space flash
- Screen Shake
- Sparks – Ignited, small debris that shoots straight out
- Debris – Larger chunks that can trail a particle effect
- Trailing Particle
- Shockwave – A scaling model (sphere, cylinder)
- Light – A point light that animates with the duration of the explosion
- Fire – The main body of the explosion
Example Layer 2:
Example Layer 3:
So, follow along. With any luck Detonator will turn into something the community will make good use of.