Understanding Bokeh and DOF in CGI

Camera Imperfections in 3D Rendering

Reading time
3 min
Published on

April 9, 2024

Blauw Films

A tactical soldier in shallow depth of field pointing a Ruger Mark IV Lite pistol towards the camera against a yellow sulfur mountain that is out of focus.

What is Bokeh?

Bokeh is a photographic lens effect in which distant bright spots of light, blur into a variety of shapes based on the aperture in the lens.

Bokeh can come in an infinite variety of shapes, softness, brightness and colours. And each type of bokeh gives a completely different effect to the image. 

Depth of field brings a sense of focus (literally) to the image by only considering a slice of the world to be sharp.
A shallow depth of field exaggerates this effect to only focus on a thin slice of space. While a deep depth of field allows you to take in a lot more of the world.

A look dev studio with white and chrome spheres gradually going out of focus as they get farther away from the camera where in the far distance there are glowing lights.

Bokeh, or blur disks

When you look at a fairly lights in the distance and you blur out your eyesight by focusing on something close by — take a moment to analyze your out-of-focus area. 

Circles with a soft core and a gradient of rings glow agains the blurry background.
These are the blur disks of your eye. And that is the bokeh of your image. 

The bokeh of the human eye from the Bokeh Builder resource by Blauw Films.


Camera-lenses or your human eyes have varying degrees of optical aberrations.
This makes every image unique in the way the blur looks and more importantly, feels.

You can make an image feel magical through the use of bokeh. And you can also make it feel claustrophobic or disorienting.

A creepy lady with soft lighting from the side who is wearing a heart shaped morph suit standing against a crimson red skyline during sunset which is out of focus.
Devilady Heartface | Read the process

The out-of-focus areas of your image take on a magnified shape of the light passing the lens elements. As the light ultimately passes through the aperture it has been filtered and cut into the shape of your bokeh. 

A diagram of how light collects on a lens which defines the look of bokeh.
A diagram of light distribution in a lens

How Bokeh works in CGI

In Computer Graphics it really works no different than in physical optics. Bokeh is calculated during the 3D-rendering process based on the same properties.
F-Stop, aperture shape, vignetting, anisotropy and overlay textures define the lens characteristics.

These settings give you all the flexibility you need to create the textured out-of-focus areas in your render. 

Download the Bokeh Builder for Free from our Resources page

Artists can use this for additional creative effects as well. CG bokeh is, in essence, using a sprite to process the light rays hitting the camera.
The more a ray is out-of-focus, the more the bokeh sprite will be magnified in front of it.

A black cube next to a white sphere against a grid of grey squares surrounded by candles in shallow depth of field.

A close-up of bokeh in a shallow depth of field 3D render test.

Animated Bokeh

Following the same train of thought, that bokeh in CGI is simply a sprite, one can imagine adding an animated image sequence as their bokeh map. Imagine, an aperture map sequence that starts of with a soft-core and a ring of light around the edges. But after a certain number of frames the aperture map starts changing — introducing chromatic aberration or darkening in the core. 

This added flexibility can come in handy when in need of artistically timed effects

A soldier wearing night vision looking down at the ground while standing on the side of a boat while in shallow depth of field. This is a still from Operation: Deli Platter by Blauw Films.
Still from Operation: Deli Platter using the Bokeh Builder

Pixar made use of this technique very effectively in Encanto (2021). There they used animated bokeh to emphasize the magical realism of fire.
Floating embers and sparks could transform as they became out of focus. Or they could have an animated glint effect as mentioned in this SideFX Houdini article

CG Bokeh gives animators and look-dev artists even more control in creating the scene you intend to make. Important aspects of cinema such as conveying emotions and storytelling, can be aided through the bokeh of a scene. 

A UMP-45 submachine gun with a clear suppressor and covered in holographic tiger camo in shallow depth of field. A still from Heist Club by Blauw Films.
Look Dev test for Heist Club using the Bokeh Builder

Conclusion

Now that you've covered the basics of bokeh, depth of field and aperture maps in 3D rendering, it's time to become a master! :)

Personally I'd suggest you just start making as many renders as you can while you actively experiment with your depth of field. The more practice you have, the more you will get comfortable with what you're looking for in your 3d renders.

I constantly ask myself "How much should we be seeing?" and then it's just about changing the settings to achieve that result.

I'd like to leave you with a few further reads on this subject: Photorealistic Depth of Field in 3D, How Camera Apertures affect Bokeh in CGI and Understanding Lens Aberrations in 3D.

Thank you for reading and good luck!

Stay connected with Blauw Films! 
For the latest updates, breakdowns and exclusive content, follow us on Instagram, LinkedIn and YouTube

Reading List

References

0 Comments

Active Here: 0
Be the first to leave a comment.
No Name
Set
Moderator
4 years ago
This is the actual comment. It's can be long or short. And must contain only text information.
(Edited)
Your comment will appear once approved by a moderator.
No Name
Set
Moderator
2 years ago
This is the actual comment. It's can be long or short. And must contain only text information.
(Edited)
Your reply will appear once approved by a moderator.
Load More Replies

New Reply

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Load More Comments
Loading

Up next

That was the latest post.

Check back soon for more entries to the library.

Previous

That was the oldest post.

We are working on updating our archives.

You might also like

A blue arrow pointing right from the Blauw Films website.
Planet Earth in a half translucent blue and purple color with a glow rendered in the Blauw Films crystal material.

Join the Newsletter!

Be the first to hear about our latest releases and news!

Want to start Dreaming in Blauw[1]?

Oh no! That didn't seem to work.

By entering your email, you agree to receive a curated newsletter from Blauw Films.

[1]: Dreams of Blauw are any form of crystallised thought based on honest expression. Sometimes they linger a shade of blue in your after-image.