Depth of Field Mobile Shader

$34
Publisher Barking Mouse Studio
File size 41.09MB
Number of files 33
Latest version 1.2.0
Latest release date 2015-05-18 06:05:31
First release date 2014-02-26 01:11:28
Supported Unity versions 2018.4.2 or higher
*** Requires Unity Pro ***
*** Advanced: requires you to modify all of your shaders***
*** Read all caveats below before purchasing***


Description:
Mobile Optimized Depth of Field is a recognizable optical effect to add an extra layer of realism to your next 2.5D or 3D mobile game. We provide a number of options to achieve the right look and feel while still maintaining a reasonable frame rate. Developed for the award-winning iOS/Android puzzle game Lost Toys

Features:
- Mobile optimised. Saves approx. 50% GPU vs. the same Unity Pro Image Effect.
- Foreground and background blur out of the box.
- Preview the effect in the editor without running your game on every tweak.
- Integrates with existing image effects, using the built-in Unity post-processing pipeline. (Too many will hinder your framerate.)
- Adjustable camera aperture.
- Adjustable blurriness (downsampling). (More blurriness will improve your framerate.)
- Aspect-ratio independent and smoothly handles screen resizes.

Example Scene Benchmarks:
iPad 3 (retina)

Mobile-optimized DoF:
30 FPS, 84% Utilization, 27.7ms Frame Time

Unity Pro Image Effects DoF:
17 FPS, 100% Utilization, 57.7ms Frame Time

Baseline:
30 FPS, 48% Utilization, 15.8ms Frame Time

Caveats:
No matter what, depth of field (or any post-process effect) will incur a performance hit on mobile, which are fill-rate constrained. 1st gen retina iPad 3's are particularly prone, which is why it was chosen as the benchmark device.

In order to achieve the performance necessary for real-time mobile depth-of-field you must modify all shaders in the scene that are expected to be out of focus or occlude focus. This package includes step-by-step instructions and helpers for making these changes and examples of their usage in a variety of shaders: Surface, Vertex-Fragment shaders, Terrain, Cutout-Transparency, Diffuse, Normal, Specular and Excluded.

ShaderLab shaders are not supported. This asset is dependent on vertex functions.

Only cutout-transparency is supported. Alpha blending isn't easily supported due to how the performance improvements work. Since alpha blending is expensive on mobile this should generally be avoided anyway.

Support

Top Publisher Assets