Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Mobile Blur Image effect dropping FPS

Discussion in 'General Graphics' started by hammadmobilesoft, Aug 13, 2015.

  1. hammadmobilesoft

    hammadmobilesoft

    Joined:
    Jan 31, 2014
    Posts:
    5
    Hello,

    I am trying to get blurred background in my android game. The optimized blur image effect gives me what i want, but only on PC. Once i deploy it on mobile the FPS drops drastically.
    I have two cameras
    First camera renders foreground.
    Second camera render background that contains a 3D object and blur image effect is attached to the second camera.

    Please help me out. Is there any other way to get blurred background.
    This is what i actually want.
    4_mmx_racing.jpg
     
  2. KingMatthew

    KingMatthew

    Joined:
    Jul 7, 2013
    Posts:
    166
    I don't know if this works on mobile but depth of field is what you are looking for.
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    People generally use DOF for this, but if that's too slow for your target and your OK with the 2 camera hack, you can do this without the blur effect at all (which is likely what is making everything so slow). Rather, just set the back (blurry) camera to render into a texture which is low res, and draw that texture to the screen before you draw the other camera. That will give you a free blur while reducing your rendering costs for everything in the background.
     
  4. hammadmobilesoft

    hammadmobilesoft

    Joined:
    Jan 31, 2014
    Posts:
    5
    Thanks for you reply guys,
    I got what i wanted by using a custom DOF effect written for mobile devices.
    Just being curious,
    shouldn't this work smoothly on mobile devices? Am i doing something wrong which results in drop of FPS?
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,445
    So, what your doing is rendering the background scene at full frame res. Then, after it's rendered this nice crisp hi-def scene, your scaling it down by rendering that output into smaller buffers, then scaling it back up again, each time performing a lot of per-pixel operations, which makes it quite costly to render.

    What I'm suggesting, if you just want is a simple blur, is to render your scene into a low res target instead. This will actually speed up the rendering of those objects since you won't need to render them at high res to begin with, and you'll skip all that work.
     
  6. hammadmobilesoft

    hammadmobilesoft

    Joined:
    Jan 31, 2014
    Posts:
    5
    Thanks for you suggestion i will look into it.
    See here is what i am doing right now.
    I have to use two camera
    First camera that renders everything and the second camera that renders only the background.
    Whenever i apply blur to the second camera the Fps drop to 3 FPS on my device. But if i use only one camera and render all my scene in it and apply Blur image effect on it the result is fine with 60 FPS on device.
    Using two cameras is a compulsion for me as i have to apply blur only to the background layer.

    Why is this happening? two camera with image effect applied only on one of these reduce FPS on mobile drastically.
    I have applied some other cheap image effects specially designed for mobile and i get the same bad performance using two cameras.

    Please suggest me something on that issue