- Home /
Gems shine effect (particle system ) reducing my performance.
Hello guys !!! I am working on project having multiple pick able objects Gems having shine (particle system) on it . This particle system shows spark shine effect with loop enabled from particle system. My problem is that if i have to add multiple gems like 40+ then shine particle will also increase and its reducing my frame rate to like 30 to 15 fps . Even i have optimized spark texture (10 kb) , but problems still there.
Answer by xainulabdeen · Jan 03, 2019 at 12:06 PM
After a long time spent I have come to the solution . Divide your gems in to 3 - 4 Patches and change the repeat duration of spark particle for each patch . like first patch duration 5 sec , second patch 10 sec and third patch to 15 sec so they will not rendered all at the same time eventually reducing the rendering load .
The particle systems aren't causing the lag, optimizing spark texture won't do much on it.
Try to make your particles as opaque as possible. The problem is the transparent particles stacking on top of each other which makes it really laggy on android/mobile platforms.
Thanks a lot for your quick response . I will try !!!!
Change transparency of material or changing it from particle system component like color over life time . if your talking about changing from material then i cant do this because shader of particle is set to mobile/particles/additive , this shader does't shows the color property .However change material to Particle/additive show color property but it shows the alert sign "this shader not good for mobile platform"....
1 - $$anonymous$$ake the particle system as small as you can, to reduce overdraw and general lag.
2 - Consider transfering the the particle system into an animation/spriting. (Which takes a long time but usually works)
RECO$$anonymous$$$$anonymous$$ENDED 3 - Try to reduce the amount of particle systems being emitted at once
Using Vector3.Distance you can calculate the difference of two GOs position, then you can use that knowledge to
if(Vector3.Distance(gem.position, player.position) <= maxdistance )
{
ParticleSystem.Stop();
}
for my reference, https://docs.unity3d.com/ScriptReference/Vector3.Distance.html. I hoped this helped :)
If you want, add me to your project via Unity co-op. Ill fix it, and you can save your project before downloading $$anonymous$$e.
Side note: If you have discord and would like to add me: pr0per #0369
local scale of object is 1 also 3d size in particle system is 1.
Answer by ifurkend · Jan 03, 2019 at 09:14 AM
Transparent overdraw aside, you may want to change the layer of your sparkle particle systems to TransparentFX and use a new camera to render this layer only (remove this layer from the main camera, parent the newcam under main cam, change clear flags to depth only.) This way drawcalls of your sparkles can be batched which improves performance.
I have already done the same thing . Adding two cameras and rendering spark particle from another camera . but issue is that particles will not hide behind the walls or hurdles . !!!!! However thanks a lot for your kind response . I will retry your approach too...
Yes, there is the trade off for drawcall batching, But more importantly whether this workaround improves your performance or not, otherwise the huge drop of framerate may not be related to particles (directly) and you should look more carefully at the profiler.
I have completely checked from every aspect .... environment is fully optimized and low poly code is also optimized. when i remove particles my frame rate remains fix to 29.98 - 30 fps . but on enabling particles it drops the frame , not every time like after 5 secs.