Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Fog runs perfect in Editor mode (400 fps) but drops to 20 fps in mobile platform

Discussion in 'General Graphics' started by mfatihbarut, Jan 16, 2021.

  1. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    179
    Hi all,
    I use Unity particle effect pack's fog effect.
    Which is wonderful
    and it even didn't increase cpu usage 1ms in editor mode
    But when I tried to test it in my phone it made the game unplayable.
    Where is the problem?
    Most importantly how can I solve this?
     
  2. Sky77

    Sky77

    Joined:
    Jan 30, 2014
    Posts:
    66
    Using multiple particle effects to cover a large part of the screen, like to simulate fog, can be extremely expensive on mobile. You can't expect to have the same performances on PC and mobile, reduce the number of particles or use some other technique to simulate fog effects.
     
  3. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    179
    It would be good to learn to simulate fog effects.
     
  4. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    179
    Besides 400 fps and 20 is not acceptable. There should be wrong with the mobile system and there should be a solution for it.
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,832
    It is very plausible for a desktop GPU to be 20 times faster than a mobile GPU. So, no, nothing is wrong. Mobile GPUs are extremely limited in their fill rate compared to desktop GPUs, and may even be running at a higher resolution than your desktop. The result is transparent effects are a huge performance hit on mobile, especially if they’re covering the full screen and / or there are multiple layers.

    The solution for mobile is to run at a lower screen resolution, and / or use fewer particles. Like way, way fewer particles... as close to none as possible.
     
    Lars-Steenhoff likes this.
  6. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    179
    but I have to make another confession. I made a sin.

    I used a flamethrower and another particle-based weapon in my game. And they (even more than one instance) work normal (with their pc version even not mobile version).
    Is the key local and world?
     
  7. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,832
    No. The key is some effects are more expensive than others.

    Could be how many particles they have. Both on the CPU side calculating the position of the particles and on the GPU with the amount of overlapping particles.

    Could be how big the particles are. The actual coverage of the geometry matters, not how big the visuals are, which is different. For example the areas of a particle's texture that is fully transparent is just as expensive to render as the areas that are partially transparent or opaque.

    Could be how complex the shader the particles are using is. More complex shader means slower, and makes screen coverage and overlaps worse. Though sometimes you can get away with a single complex shader that's faster than multiple cheap ones.

    Flame thrower effects pretty commonly use about the most basic unlit additive particle system possible. This can still be expensive if you have a lot of them covering the screen, but additive particles are generally the cheapest option (on hardware that cares about different blend modes for performance, which not all do).

    Your fog effect particles are likely doing some amount of soft particle-ness so they don't cut sharply into the ground, alpha blending, and maybe even some lighting calculations. Each of those is going to make them substantially more costly to render than unlit additive particles. But they're also fairly important to the end look.
     
  8. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    179
    I put the fog to cover a valley. What if I record it as a movie and put that movie on a plane and put that plane to fill valley?
     
  9. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,832
    Could be a good option, sure.
     
  10. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    179
    I tried it. As an idea it worked as intended and looking as a solution.
    However I have another simple issue that I couldn't solve now, stretch. I can not show the movie I recorded as its original quality(look)
    I use videoplayer and render text, I followed every recommended steps. (change resolution to video size etc.) but still video is not seen as its original.
     
unityunity