Photorealistic Depth of Field in CGI

Create Bokeh in your 3D Render Engine

Reading time
3 min
Published on

December 8, 2022

Blauw Films

This is a bokeh test that shows depth of field with a custom bokeh. A 3D render of a cube next to sphere in front of a UV grid that showcases depth of field and bokeh that is achieved by using a custom aperture map from the Blauw Films Bokeh Builder resource.

Creating Realistic Bokeh in CGI

You can achieve lots of Subtle Realism in CGI by using our Freely Available custom aperture maps!
This way we can replicate camera techniques through through visual effects, creating Bokeh.

A digital asset box with a cd sticking out of it from the side. This is the Bokeh Builder from Blauw Films.
Download the Bokeh Builder for Free



For those new to this phenomenon, bokeh is an element ever-present in life.
Whether you look through a camera lens with crafted optics, or through your own eyes...

There is always bokeh.

For the longest time, I've been trying to achieve a higher level of photorealism in my work.
The look and feel of the depth of field is one of those areas that became a personal obsession.

The Importance of Realistic Bokeh

Working on a tutorial for creating bokeh in cgi allowed me to experiment a lot with aperture maps :)
It is important to find a workflow for yourself in which you can focus on what matters to your visual arts.

Creating a photographic look and feel to my 3d renders has always been important to me.
I'm always experimenting with camera and lighting techniques to achieve more cinematic "computer generated images".

A close-up 3D render of a soldier Pedro Gomez from Operation: Deli Platter aiming his gun towards the camera while on a speeding boat. The still is shallow depth of field and we can see Pedro's eye through the EOTech holographic sight.
Pedro Gomez in Operation: Deli Platter | Depth of Field with Bokeh Builder



In my long process of Research & Development to improve my work as a 3d artist this was one area I’d often overlooked.

To make it fun for myself — and learn something on the way —
I wanted to solve a personal challenge: How to match our eyes’ bokeh?

A 3D render of a close up of a male face with their eyes in shallow depth of field close to the camera. This render is photorealism.There is colourful bokeh in the background and dramatic lighting on the character.
Early experiment of using the Chaos Corona Camera DOF settings

The Human Eye and the Camera

The aperture map below is my first attempt at creating an Eye bokeh texture map.

I made this texture in Photoshop by combining diverse eye-surgery photographs.
Extracting the right color values was a bit tricky but I’m happy with how it turned out.

When I defocus my vision I see a pretty similar bokeh shape.

An aperture map that represents the blur disk from a human eye. This is part of the Bokeh Builder resource by Blauw Films to create photorealistic 3D renders and depth of field.
Download Bokeh Builder for Free through our Store!


If you want to achieve a stronger difference between highlights and shadows in your Depth-of-Field, you can increase the contrast of your aperture map texture.
But for most photorealistic renders I recommend using a subtle contrast ratio.

A 3d render of many out of focus lights being visualised through an aperture map of the human eye with bokeh vignetting turned on to give the effect of a cat eye bokeh.
Preview of how the Aperture Map affects the Depth of Field | Bokeh Vignetting gives the Cat Eye effect



It is important to use real camera techniques and cinematic lighting techniques together to achieve the best result.
And if you have too strong of a contrast in your aperture map, you can create distracting artifacts in your blur.


A 3D render of a focus chart and a color checker in a studio lit environment. The focus is on the focus chart in the distance. The color checker is out of focus and we can see how the bokeh looks on the image.
Using the Free Turntable Backdrop to text sharpness and personality.

A 3D render of a focus chart and a color checker in a studio lit environment. The focus is on the color checker in the foreground. The focus chart is out of focus and we can see how the bokeh looks on the image.

The human eye aperture map generates organic 3d renders with lots of camera imperfections.
But that might not be what you are looking for.

A traditional camera lens is made of diverse crafted optics such as the front elements, the aperture, the lens groups and the rear element.
Each lens is different. And so is each lens' bokeh.

Alright, here are some tests with a Heptagonal over-compensated aperture:


A 3D render of a focus chart and a color checker in a studio lit environment. The focus is on the color checker in the foreground. The focus chart is out of focus and we can see how the bokeh looks on the image.

Notice the subtle changes in the intensity of the Depth-of-Field relative to the F-Stop of the lens:

A 3D render of a focus chart and a color checker in a studio lit environment. The focus is on the color checker in the foreground. The focus chart is out of focus and we can see how the bokeh looks on the image.

A 3D render of a focus chart and a color checker in a studio lit environment. The focus is on the color checker in the foreground. The focus chart is out of focus and we can see how the bokeh looks on the image.

A 3D render of a focus chart and a color checker in a studio lit environment. The focus is on the color checker in the foreground. The focus chart is out of focus and we can see how the bokeh looks on the image.

With a closed down aperture, such as in the example above, you can see there is barely any contrast between what is in-focus and what is out-of-focus.

An example of an aperture map texture of a lens that is over-compensated. This aperture map comes from the Blauw Films Bokeh Builder resource for filmmakers and 3D artists.

Production Ready Aperture Maps

The cinematic quality of your 3d-render is based on the interplay between all factors.
From camera setup to lighting techniques, and even something as subtle as the feel of your blur.

The more you open your aperture, such as F/1.2, the more the effects become extremely obvious.
In the above examples you could see the subtle effects of the bokeh, even on a Wide Depth of Field like F/16.

But it's important to consider what aperture shape you want to use in your render.
A heptagonal aperture geometrically "splits" the out of focus area into overlapping heptagons.
The same is true for any aperture shape, together with any level of light compensation.

It all has an effect on how your blurry areas look.

The Bokeh Builder project file inside of Adobe After Effects with all the customisation to create your own lens aperture maps.
Find the Bokeh Builder on our Resources Page

Both of these examples are with low chromatic aberration.
I will soon be rendering tests with higher levels of aberrations, as well as different aperture imperfection maps.

For those with experience of camera lenses and optics you will be familiar with the following chart:


Examples of aperture map textures of a lens that is under-compensated, balanced and over-compensated.

Lenses (both organic and crafted) come in a variety of shapes (aperture shape).
But the light distribution within that shape can vary lots from lens to lens.

A 13-sided aperture can be

  • under-compensated (light collects in the center, giving soft edges)
  • balanced (slightly sharp outlines, evenly lit blur disk)
  • over-compensated (light collects to the sides, creating halo bokeh)

That's pretty much it about lenses for now.

More Blogs on Bokeh

If you're interested in achieving Photo-realism in your renders, this blog on the effect of Bokeh on Photo-realism goes into greater depth. And if you want to go even more in-depth! There is the following blog on understanding lens aberrations in 3D.


After Effects screenshot of the Blauw Films Bokeh Builder. Achieve realism in your 3D renders through custom aperature maps.
Bokeh Builder is an After Effects set-up to create custom aperture maps

After Effects screenshot of the Blauw Films Bokeh Builder. Achieve realism in your 3D renders through custom aperature maps.
Bokeh Builder is available as a Free Download on the Store

Conclusion

Achieving a photorealistic 3D-render is a fine balance of creativity and technical skill. Bokeh is a relatively fun and easy place to start to increase the photorealism of your 3D-renders. No matter what your preference is for how you want your renders to feel, there is always an aperture map that will best suit your depth of field.

I'd love to see what you make with the Bokeh Builder! So feel free to contact us with your art or tag us on Instagram :) 

Table of Contents
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.