Because I have learned quite a bit since I started this tutorial series, I have found that I really should have explained some theory about creating effects because we ever started writing code as we may have made some different design choices. This next part will focus on some heavy particle effect theory on how to get convincing effects using what I call senses of motion.
I also, would like to give a brief rundown of what is to come. Part 4 will be revamping what was done in parts 1 and 2. Part 4 and 5 will focus on management of particle systems/emitters. Then 6 will show how to port what we have done to run with opengl. Finally, anything else will be showing how to use the system to do different effects such as trails.Requirements:What you get:
- A solid foundation on how particles create an effect.
- A better understanding on how you would go about coding a particle library.
I absolutely love games with awesome effects. However, even with AAA titles I still find effects that look like crap. Ones that I know I could make look better without any additional art resources or increasing budgets. Indie games also have huge problems with effects looking very bad. Spawning 500, 1000, or more particles with a smoke texture does not make billowing smoke. Using any particle system to create believable effects is an art form. An art that is actually easy to pick up.
Creating believable effects is all about using motion. Pick your favorite game or games. Look at some of the coolest effects in the game. Seriously pause reading this and go look at them. How were they? Cool, right. Now think of how they were done. Why they looked real or cool. I bet no effect was a single just sitting there in the scene. The key to good effects is using motion. There are many forms of motion. I am going to mention a several common ones.Movement:
This is the most common. A static image just is not convincing. Moving adds to the illusion of an effect.Rotation:
Rotation helps create the illusion. Make sure to have particles not all rotate clockwise or counter-clockwise but both.Scaling:
Scaling is another common sense of motion. Yet this is not simply growing or shrinking there are many forms. You can grow/shrink each x,y, or z axis independently.Color:
Changing the color over the life of a particle is a nice effect and one that is very important to have.Transparency:
Fading particles in, out, and back again. This is one some would bundle into color but it is a completely different sense of motion and one that I think is very important.Emittion Shape:
The shape or way the particle are emitted into the scene. Circle, box, cone, angle, and any other from that changes how the particles enter the world.Compositing Particles:
One particle moving across another or on top of another is integral to creating an illusion that all the particles or one entity. This sense of motion is key to keeping the viewer from noticing that most particles are a single image.
Instead of using one smoke image, use 4 or 10. This adds a variety to the effect. Particles will no longer all have the same image making it hard to tell they are not the effect trying to be produced.Animated Image:
One step above multiple images. This is having an animation playing for each particle independently. This can add a huge sense of realism and motion but cost more memory.Complex Forces:
This is where we add things like gravity, forces, wind, and other physics type of effects to the particles to enhance their basic movement.Complex Composition:
Additive blending, Multiplicative blending, and various alpha composition. This is where we using different and advanced forms of image composites when rendering the particles to help produce an effect. Google additive blending.Multiple System Composition:
Compositing many particle effects together to make an effect. A system to launch dirt into the air, spawn smoke, spawn little bits of debris, spawn spars, delayed black smoke, delayed embers, shock wave, spawn huge billowing fire, spawn shrapnel with trails, and others are just a few systems that would make up a nice explosion.Shaders:
Can add many effects to the way particles are rendered and a must in any advanced particle system.
These are some of the most common senses of motion. Sure particles can also have some physics for world collision and maybe some other things but these really are core.
With that being said. Go look at that game/s effects again and think of these sense of motion. I bet you dissected the effect for more effectively now that you knew some things to look for. It is like listening to music, the more instruments you know and the longer you have studied them, the easy it is to pick a song apart.
So why look at other games effects? To learn. I strongly recommend pausing gameplay and just looking around and see if you can figure out how they developers did things or even look at the actual textures used.
Lets look at a few examples of bad or lacking effects.
Mass Effect 3 was a great game for me. The effects looked great when you did not look at them. If you look at most effects such as smoke or explosions. you quickly see that there are only a few images that creates the effect. Some only have one. One particular one that you see all the time is the Centurion smoke grenade.
It looks fancy but when you move around you can tell it is a single image billboarded (google this term) to face the camera. There is a shader effect on it to make it "wobble". This is not a bad effect but one that could use work.
I recently started tinkering with unity and was browsing their asset store and came across "Ultra Realistic Fire and Some" or something. Look at the demo http://www.sea-estate.ru/test.html
The effects look quite bad. The fire seems kinda "real" as it is using some realistic textures but they do not move enough at all. The smoke is horrible. It is like 1000 particles. The 1000 isn't the problem but that you can tell it is 1000.
We could go on and on looking at games or apps but now we will go over effectively using some of these senses of motion.
Here are a few particle editors out for you to play with. I would love to do a video as pictures really do not do justice but really you need to play with an editor to understand. I also, do not have a microphone.
Unity3D: Their editor is easy to get into and has a very nice UI. Play with it.
Libgdx: Their particle editor is similar to Unity's as they both like curves instead of numbers.
SystemX: This is my custom editor. It is a little wonky and is missing some features but I think it is the easiest for loading images/sprite sheets/animations for particles. It also has some textures for you to use.
Here are some additional free particle animations to try out.http://opengameart.org/content/explosion-sheethttp://opengameart.org/content/more-explosionshttp://opengameart.org/content/magic-and-smoke-effect
Play with composting particle on one another with motion and rotation. While particles move across one another you get a very nice illusion of an effect. Also, composite multiple emitters/particle systems on each other for a similar effect. Try to use as few particles as possible. With the unity and libgdx editors have the particles fade in and fade out to eliminate popping. Popping is where a particle just "pops" into the world or "pops" out of the world. This never happens in real life. Also, try some animate, multiple textures, and single texture particle effects to see how much better/worse the effect is.
Now think of how you would code a particle library. How would you go about adding in these different motions. Would you opt for curves or stick with fixed numbers. There is no right way. Think about it until next time when we revamp things.
Next time we will refactor old code and write some new stuff to make things better.
Here is a screen using my editor and one of the provided textures.