1

I'm playing around with Unity Image Effects on a 2d game, specifically I'm trying to blur background of my main menu when game settings are displayed on a popup. I've achieved by using two cameras:

  • A main camera in which foreground objects are drawn
  • A background camera with the blur (optimized) effect which properties I programmatically change when settings are displayed

enter image description here

It's working great on Unity Editor, but once I run it on a device (Galaxy S6) it gets terribly slow. I'm guessing blur effect is just too much for handheld devices, but still I wonder if I could get better results just tweaking camera params, it's hard to believe that a (almost) last generation device can't move this scene (just a fullscreen background with the blur effect and a couple of buttons on top of it) smoothly.

Any idea of things I could try to improve performance?

As a side note, I'm rendering my sprites with 2dToolkit.

ssantos
  • 16,001
  • 7
  • 50
  • 70
  • what I did was to render the blur camera to a RenderTexture once, disable the camera and then show the RenderTexture as an static image. – JeanLuc Nov 10 '16 at 18:49
  • Thanks @JeanLuc, actually the background is a bit animated, that's the point of a dynamic blur instead of just using a plain png blurred on photoshop :( – ssantos Nov 10 '16 at 21:05
  • i did not mean to show an image blurred in photoshop, but to show rendered blurred texture. anyway since you background is animated i would suggest to increase Downsample and to simplify the blur shader by taking less pixel into the calculation. – JeanLuc Nov 11 '16 at 07:49

1 Answers1

1

Blur is heavy on mobile devices. Bear in mind that an S6 has a more than full-HD screen. (2560x1440). That is probably more than you testen on your desktop. Do like Jean Luc did. If your background is static, rendertotexture only once.

Hacky
  • 305
  • 4
  • 15
  • Because the background is blurred, you could try to render only half the pixels. – Hacky Nov 10 '16 at 20:35
  • Thanks @Hacky, I did some performance tests with veeery low quality pngs, but still far from 60fps. Not sure if that's what you meant, any other way to reduce the amount of pixels rendered? – ssantos Nov 10 '16 at 21:06
  • The optimized blur script could render half the resolution and then resize the en-result. – Hacky Nov 11 '16 at 13:06
  • I don't think that changing the PNG size will make any difference here. It's probably just the optimized blur script that has to calculate a blur kernel for every pixel. Thats simply a lot of memory lookup. You could alter the optimized blur script to only render half the resolution and then resize the end-result. – Hacky Nov 11 '16 at 13:13
  • Thanks @Hacky, unfortunately tweaking the insides of a shader is currently a bit out of my skills :) Anyway, if I have a chance I'll give it a try. Thanks! – ssantos Nov 11 '16 at 13:49