WebGL: Depth Of Field is killing performances.

Hi everyone,

I got a strange issue, when I use the Depth Of Field effect in a WebGL build, I got some strange performance issues. The framerate is randomly dropping, sometimes to 20 FPS, other times to 47FPS, or sometimes it runs at 60FPS without problems.

That is pretty strange because I can use some real-time refractions without having much performance drop ( sometimes dropping from 60 FPS to 55 FPS ).

Does someone also have this problem ?

Unity version: 5.3.5f1
Firefox version: 46.0.1 x64

Thanks for reading me :slight_smile:

exactly having same problem.
i run my game on ios
1.iphone6s plus - same fps as 30 but gets super overheated you can make a grilled cheese with it.
2.ipod touch4?5? - fps drops to 2!!! which used to be 24~30

i thought it was some other problem but… it was depth of field problem…
haven’t found solution yet and i’m willing hardly for to.

sorry! didn’t help

Depth of Field is a pretty intensive effect. I don’t know what to expect from webgl, but AFAIK the performance is not quite there yet.

The iOS numbers sound corrent co me.

I mean, why can I use some real-time refractions that are ultra intensive, but not use some simple effect like depth of field ? The only way I found is to force it disabled and put an alert message on the option menu of my game explaining why it can’t be activated for the moment.

Which DOF filter are you using btw and at what settings?

“Depth of Field” script, not the deprecated one.
2749173--198251--screen.png

I think it would be worth checking the profiler and see exactly where you are losing performance.

Loosing performance on rendering only

These are desktop class effects whichever way you look at it. Look for a mobile based effect, perhaps on asset store?

Maybe, but I don’t get it. Why can I use all others Image Effects without problems, but only Depth of Field causing problems ? With newer version of Unity, the framerate doesn’t just go down, it sometimes goes up as hell, even ignoring the VSync and framerate limitations. On a 75Hz monitor with VSync enabled, without DoF it was running fine at 75FPS, but with DoF, the game was sometimes running at 87FPS or even 122FPS. I’ve already asked about this on the Unity Bar&Grill, people said they didn’t knew this issue. I’ve ended up thinking that the WebGL rendering engine or rendering pipeline, or whatever it is, is maybe broken or incompatible with DoF. So I’ve disabled the DoF toggle in my game and put a red message “! Broken !” on it.

EDIT: I’ve just tested again, the only way to have it running fine is to use an nVidia GPU to run the game on Firefox, but Firefox is known to have hardware acceleration issues with nVidia GPUs, and even recommend user to not use the GPU to accelerate graphics from the browser… Should I rely on some unstable setup to have my games looking how I want them to look, or disable the DoF to maximimze compatibility ? On my Intel HD 4000, the framerates goes completly inconsistant and mad, and on my Android Smartphone, even if it’s a low-end phone, have the framerate dropping from 20FPS without DoF to 1-3FPS with DoF, and have the same framerate problems…