It's been a month since I decided to challenge my self with implementing Bokeh Depth of Field effect and began learning complex postfx pipelines.

I've learned a lot about post processing and I'm a lot more comfortable with Scatter-as-Gather thinking.

This project is going to be on The Forge Rendering API as a UnitTest and is currently available in my github respository: Bokeh Depth of Field

Bokeh Depth Of Field

Bokeh Depth Of Field is a Physical Camera Effect created due to Focal Length, Aperture size, shape

Implementing Different Algorithms to mimic This Project is using The Forge Rendering API, a cross-platform rendering, and targeted for these devices: PC, Android, macOS, IOS, IPad OS devices.

Here is the 3 different methods implemented explained briefly:

I will soon write a blog post with a lot more detail and pros-and-cons on it.

Techniques Brief Description:


1. Circular Seperable Depth of Field

Circular Sperable DOF by Kleber Garcia at Frostbite EA which was shipped with FIFA17 , NHS, Mass Effect Andromeda, Anthem and is going to be shipped with the new Need For Speed Heat.

This technique is a seperable convolution filter like the Gaussian Filter and this makes it super faster than the "1-Pass 2D Kernel".

Derivation of the Kernel Weights and the Math includes Complex Numbers and Fourier Transforms explained in Olli Niemitalo's blog post.

In his paper some important notes were missing like how we do the "blending" so I had to get creative and do a lot of thinking myself.

This method is operating on Near, Far Field Seperatly on multiple passes


2. Practical Gather-based Bokeh Depth of Field

Practical Gather-Based Depth of Field which is fully described in GPU-Zen Book.

This approach is also Gather-Based but the sampling and computation is not seperable and is circular sampling with 48 samples.


3. Single Pass Depth of Field

Depth of Field in a Single Pass which is described in Dennis Gustafsson awsome blog post.

This Depth of Field effect is done in a Single Pass.

Due to this technique being in full-res and needing a lot more sample and calculations It performance is now worse than the other two.

There are a lot of optimizations for this technique but since I forced it to be in a single pass my hands were tight (by myself).


Real-Time Bokeh Screen Shots

Implemented Techniques

Issues

Report any bug on your devices with most detail here

Resources

All Bokeh Links and Book Chapters gathered for R&D are in this github gist; for detailed resources and links see below: