Tips for particles on IOS

Hi all- I’m looking for tips to get a lot of particles moving on screen as efficiently as possible in Unity.

I’m working on a top down (e.g. 2.5d) space game and want a star field of sorts. It needs to be performant on IOS. The trouble is that the game area zooms in and out, so to create enough stars to cover the game area, I’m looking at thousands of particles. This works fine in the editor, but on the device, it’s naturally too slow to really work. The stars are important part of the gameplay as they add a sense of movement (see this videoclip of my play area & camera style to get a sense of what I mean by zooming in and out [Dark Quadrant] working cameras - YouTube)

Some things that make this different from the standard particle question:

  1. I’m trying to fill a space, 4000x4000x4000, where in one view, you may see as much as 2000x2000x4000 of it. Because it zooms in and out, I can’t see a way of improving performance by culling what’s not in view.
  2. There is practically no overdraw as they’re tiny discrete stars.

I’ve tried various other ways to get stars in there (the most disasterous was 3 x full-screen single transparent planes with starfield texture, attempting to give a sense of depth)

Some subquestions:

  • Assuming a starfield of say 500 stars-- would it be better to give them high energy (so they stay around permanently), or a min/max energy range (to potentially halve the number of particles drawn on screen at a given point in time)

  • I’m currently using an additive mobile shader- presumably this is my best bet?

  • Is there some sort of camera trick I could do to better manage the need for lots of stars to be visible when zoomed in, but, relative to the area visible, less stars visible when zoomed out?

  • Would it be worth trying to individually manipulate / recycle 100-150 particles to redistribute them based on how zoomed in you are?

Hey man,

Sounds like a lot of particles your throwing around there, I’m not 100% sure if your going to find much joy on mobile devices without hardware acceleration there.

My advice would be to use the Skybox with some foreground objects / planes to give depth :wink:

Don’t use particles for your stars. Just don’t.

I made a good looking global 3d starfield by instantiating quads of random size (based on actual stats of visible star magnitude) with a star texture using Random.OnUnitSphere and then making them all face the center; then moving them far away and combining the mesh.

Here’s an idea- Since yours is a 2d scroller, make the stars on a big cylinder instead of a big sphere, then rotate the cylinder counterclockwise as you accelerate forward, clockwise when you go back, and move its center closer or farther from the camera when you zoom in and out on the ship. It might be a good idea to have one camera that sees nothing but stars, and a lower one that sees only nebulae (on an inward facing cylinder with a seamless texture map) that can be low-res because nebulae are blurry. But the stars will appear sharp at any zoom level.

Stars shouldn’t have parallax anyway- you can only ever be close enough to one star (the sun of the planet you’re flying by) to see it move differently relative to the other stars; and no way you’re traveling at warp speed while dodging and shooting stuff.

But you can add dust clouds, asteroids, etc. that are closer and do move with parrallax.