Can You Make Computerized Shaped Bokeh?

Computerized Shaped BokehAs you probably know DIYP has a small feish for shaped boekh (we even made a kit).

Mike Pan was interested to see if a similar effect can be computer generated. well, it can using blender and cycles. Here is what Mike has to say about it.

It all started with the release of Cycles – a new GPU based (read: Fast) path-tracing (read: Nice) rendering engine for the 3D software Blender. For people unfamiliar with the concept, a rendering engine is a software that turns a computer generated 3D scene into a final picture. A rendering engine has to calculates lights, shadows, surface materials and all the intricate details that make up a believable virtual world. Most rendering engines uses all kind of tricks and shortcuts to simulate surfaces and lighting, whereas Cycles rendering is purely based on the physics of light, which means it is very easy to get photo-realistic renderings like this:

Computerized Shaped Bokeh

Unlike a real camera, a virtual camera in the 3D world doesn’t use a compound set of lenses and a film plane to capture the image. For example, to change the zoom of our virtual camera is a simple process of changing some variables in the perspective calculation equation.

How does this all tie in to photography? In a real camera, if you place a small opening in front of a camera lens, it will block off some light entering the lens, and we call this opening the “the aperture”. Turns out, the shape of the aperture dictates the shape of the bokeh. A typical bokeh of a wide open lens looks like little round disks because the lens aperture is round.

Bokeh, as you probably know, refers to the out-of-focus highlights in a photograph as a result of shallow depth-of-field composition. With me so far?



Through the glass

A “stopped-down” lens might produce bokeh that looks like hexagons (because the aperture is made up of distinct blades) as displayed with Magic Bokeh by Jah-hoo-ah.

Magic Bokeh

An anamorphic lens produces bokeh that is stretched (because the lens squeezes the image non-proportionally to fit 2.35:1 aspect ratio into a 3:2 image circle):

Computerized Shaped Bokeh

Here comes the coolest part, if you placed a custom shaped opening in front of the lens, the bokeh will take the shape of that opening:

Bokeh Heart


Bokeh Heart

Back to computer graphics. I was curious to see if the Cycles is as robust as it is advertised. After all, a ‘physical-based’ rendering engine should be able to simulate light interactions just as they behave in the real world. So when I set up a simple scene and placed a heart shaped opening in front of my virtual camera, this is what I got.

Computerized Shaped Bokeh

Notice how the light source behind the monkeys turned into little heart shapes. Neat eh? What even more amazing is that I noticed the bokeh is distorted near the frame edge, exactly how my 50mm F1.4 behaves when used wide-open.

This little experiment was nothing more than a test to see what can be accomplished with today’s cutting edge graphic technology, and bring together my two passion – computer graphics and photography – together.

Mike is a 3D computer graphics artist and an amateur photographer. You can find him on Twitter, Flickr or his website.