So I've ran into the problem of overdraw in Unity while working on a game for iOS. My solution has been to bake out sprite sheets of FX from either After FX or Maya. This however is really time consuming. Are there any other work arounds aside from keeping particle count low and the aforementioned solution? I have access to pretty good compression tools, but I imagine at some point, memory will become a factor.
Replies
For many effects that seem as if they'd naturally have a lot of layers (like explosions), I try to create the main shape of the effect using just one layer of mesh. An explosion, for example, might just be a rounded cube or sphere that scales up over time. If it's got a nice-looking shader on it, it gives you the main body of the effect, and you can decorate it with smaller bits (rubble, sparks, etc.), and fake the look of something quite complex while not resorting to having many layers of large particles.
Otherwise, I try to have my textures as opaque as possible without it looking crap, so that I can get away with fewer layers of particles.
Lastly, I tend to throw a few more verts at my meshes, cutting them so that bits that would be fully transparent are cut out. If you rolled your own particle system, it'd be helpful to have the system have the option to use octogons as particles instead of quads, as many fx input textures are circular rather than square.
Well, you can do that in Unity by using a mesh renderer and adding your own mesh yes? That said I've always wondered about any performance differences between the default billboard renderer and any user-input mesh renderer (other than vert count of course)
I'd be keen to hear if there are ways to get around that. I imagine you could script the particles array in your ParticleSystem and force them to face the camera, though that sounds super inelegant and inefficient. Otherwise, maybe you'd have to roll a custom shader to do the billboarding transforms, but I failed to get to what I wanted the last time I tried it. :P
So this is just essentially a prefab? I'm actually really interested in doing something like this. A similar solution was suggested to me though, I don't really have a background in scripting/coding. Are there any tutorials that speak directly to this kinda of solution? Thanks for the replies. Awesome feedback!
I'm afraid I learnt all of my shader-wrangling on the job under the watchful eye of a senior graphics programmer, but the general idea for the explosions I've done in the past is to use a shader that has a fresnel falloff (to soften the edge of the mesh, so it doesn't look like an obvious mesh) and a scrolling texture to make it look as if the explosion's rippling outward.
It looks kinda crap on its own, but I feel it provides a nice base for the shape, and is super cheap to render, so as I said you can add a lot of smaller bits to it to give it nuance and personality, while keeping it quite cheap. (I end up with a few more draw calls because of the different pieces, but very few layers of overdraw, so depending on what else is happening in the game, I might still opt for a flipbook. Depends on where our bottleneck is.)