Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is there a simple blur image effect for mobile

Discussion in 'Image Effects' started by petey, Jan 3, 2018.

  1. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,817
    Hi there,

    Just wondering if there is a simple image blur effect that could be used on mobile.
    There used to be this one - https://docs.unity3d.com/500/Documentation/Manual/script-BlurOptimized.html
    It seems if I look for that, everything suggests using the new stack, but that seems like it will be a little too harsh for my mobile project.
    (also there isn't a full screen blur effect in the post process stack)


    Any suggestions?
    Thanks!
    Pete
     
    Last edited: Jan 3, 2018
  2. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    823
    For blur on mobile you will need to do a few tricks in order to be performant. I made my own effect based on those two guides:
    https://software.intel.com/en-us/blogs/2014/07/15/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms
    http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/

    Before that I tried an asset (https://assetstore.unity.com/packages/vfx/shaders/gaussian-blur-42388), but it was to performance heavy for mobile. Not quite sure if there is a good asset out there now.
     
  3. Kumo-Kairo

    Kumo-Kairo

    Joined:
    Sep 2, 2013
    Posts:
    343
    @petey do you need a complete blur or Depth Of Field? What is your case?
     
  4. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    If blur is your only image effect that is required - I recommend you write up your own blur shader. It should go something like:
    -Downsample image to about 1/4 resolution
    -Perform a 2-pass horizontal/vertical gaussian blur (or box blur works as well)

    If you use other effects like Bloom - you should combine the blur with your bloom so you don't need to perform extra instructions. For instance, PRISM (linked in my sig) gives you a checkbox inside the bloom effect if you just want to blur the whole screen - it uses the already-generated bloom texture for this, so there is 0 extra performance hit if you're already using bloom.
     
  5. Kumo-Kairo

    Kumo-Kairo

    Joined:
    Sep 2, 2013
    Posts:
    343
    Downsampling by a relative amount like 1/4 of the resolution makes a very distinct appearance on different devices. Hi-rez devises will have smaller blur, low-rez devices will have larger blur. This is what we see in the FxPro package - bloom looks completely different on different resolutions. The difference becomes much more apparent on devices with the same screen sizes, but different DPIs.
    This is usually not an issue on PC targets because it's mostly 1080 pixels height, so blur and bloom look mostly the same.

    I strongly encourage to blur some fixed resolution instead. This is the technique that's used in Sleek Render and it really enables completely consistently-looking bloom on the whole range of devices.
     
    Last edited: Jan 29, 2018
    bing2 and chrismarch like this.
  6. grrava

    grrava

    Joined:
    Nov 11, 2012
    Posts:
    46
    VOTRUBEC, PatHightree and raphaelnew like this.