Hello guys, I am considering to rewrite my game to use SPS extensively.
From performance point of view I was at the end of my abilities three days ago. I did
- Reused meshes (disabled when hidden, enabled when needed again)
- Merge what doesnt move
- Used instances for whatever was moving (problem with light.includedOnlyMeshes there)
- Frozen world matrices
- Frozen active meshes only to unfreeze once every 30 frames for recount - this one provides BIG improvement and maybe deserve more publicity !
I have to say that with above setup I was pretty much ok even on my Galaxy S7 - UNTIL (sadly) I have added more moving objects (monsters). When I have done this, then I felt that even with all that optimizations I have seen lowered FPS soon on my phone.
I said myself ok, probably thats just the limit, until I found SOLID PARTICLE SYSTEM.
At first - I tried to use it for my tile-based terrain. Whole background terrain is just one mesh with texture atlas and it works like a charm - one draw call (before it was like 10 - 20 draw calls) and you are done baby.
It seems to be so powerfull that I am considering to use SPS for my objects too (trees, bushes, fences) basically all that are expected to be in 10+ entities (instances for those that arent expected to be repeated too much).
I will end with one SPS for every “object type” with possibility to even merge more object types into one SPS later (objects of same material).
I am considering to use SPS even for monsters (one SPS per monster type or per monster - not sure yet).
And that leads to my humble question - this will take a lot of effort and I am afraid that there will come some problem that will ruin it all Is there some disadvantage of SPS that is not clear at the first look ?
I think that I might end with like 50 SPS objects when full scene (objects, monsters, players) - it is just 50 draw calls which is something that I cannot achieve “standard” way.
What I am afraid of:
Shadows - my SPSes will be big meshes (boundary wise) with lot of empty space inside and I am afraid that it could cause trouble on generation of shadows (although by this time I have seen that the gibber object, the more precise shadow).
That SPSes will have like 50 - 100 particles but those could be spread well over screen thus most of these SPSes will be “big meshes” at the end (even with lot of empty space inside them). Which could lead to some trouble maybe.
I am not sure about overhead of SPS in comparison with normal mesh. Will be lets say 30 - 50 SPSes manageable or is there something to be concerned with ? Worth to mention that most of SPSes will be static objects that would not be updated often.
I cannot add new shape into existing mesh (is this still the case ?) which means that I will need to add enough particles at the start (it will be at least 50 - 100 for each SPS but lot of then will be alive = false most of the time)
As most of my scene would be consisted of large SPSes (large by boundary size, not complexity) I am afraid that it may cuase some problem for lights (I am using one spot and 3 - 8 point lights usually) - but maybe it is just about complexity of mesh and not about its absolute size, I am not sure here.
Something that I cannot even imagine
If none of these aforementioned aspects will cause serious trouble, then it is awesome and SPS will just save the world, but when something is THAT GOOD, I am always little bit nervous
Thanx everyone for some insight into this !!!
And thanx again to those who invented this brilliant SPS object !