Bokeh, created by manipulating the aperture

Bokeh is a term used to describe the quality of blurring in out-of-focus areas of an image. It is related to the camera's aperture and quality of the lens. A point in an image that is out of focus is no longer rendered as a point, but a blurred disk. Depending on how the lens has been corrected for spherical aberration (imperfections caused by light rays striking a mirrors edge), the disc may be uniformly illuminated (“constant” bokeh), brighter at the edge (“bad” bokeh), or brighter near the middle (“good” bokeh). Poorly corrected lenses will show one type of disc in front of the focal distance and another type behind, which may be desirable, as these circles with a dimmer edge can produce smoother less-defined shapes in the surrounding image. When the aperture is stopped down from its maximum size the out-of-focus points are blurred into the polygonal shape of the aperture, instead of perfect circles. Some modern day cameras have curved edges on the aperture blades, or a greater number of blades to make the bokeh closely match a circle as much as possible.

Aperture shape of a real lens.

RenderMan's virtual camera offers fine control over the aperture's shape and behavior. You can specify the number of  sides (i.e., blades) for the shape of the aperture, rotate the angle of the aperture, make the sides of the aperture bow inwards or outwards (i.e., change the aperture's roundness), and control the aperture's density to alter the shape of the brightness.

The aperture shape is controlled by the aperture camera projection options, such as those found in PxrCamera. You can switch projections while retaining these controls.

Sides: The number of diaphragm blades does not technically control bokeh, but does control the shape of your blur circle (but not how light is distributed within it). Changing the number of sides causes our once perfect circular highlights to facet with as many sides as specified (three sides, for example, produces a triangle).

Angle: This spins the aperture around, rotating the out-of-focus points.

Roundness: The roundness will curve the edges of our aperture blades in order to give them a more rounded appearance. Thus giving your highlights a more rounded shape.

Density: "Good bokeh" is classed as having a brighter center and a falloff towards the edges in each de-focused point of light. However not every lens has good bokeh. You are able to mimic the good (or bad) light falloff in your lens by using this control. The default of 0 gives a constant brightness (neutral bokeh), -1 is brighter at the center and a falloff towards the edge (good bokeh). and 1 gives you a bright rim (bad bokeh).

Some examples (note that Depth Of Field must be enabled for Bokeh effects):

The default aperture is circular; we can see this by using a small, bright point that is out of focus. Ordinarily, a point this out of focus would not be visible - its light would be too spread out over the film plane - so we have to make it artificially bright to show up. Yielding this image:


[0 0 0 0]

By setting the sides to 5, the aperture becomes a pentagon.

[5 0 0 0]

Setting the angle to 36 rotates the aperture counterclockwise by 36 degrees.

 

[5 36 0 0]

A positive roundness value makes the sides of the pentagon bow outward.

 

[5 36 0.5 0]

A negative roundness makes the sides of the pentagon bow inward. Note that because the light is spread over a smaller area, the bokeh here is somewhat brighter.

 

[5 36 -0.8 0]

A positive density makes the aperture transmit more light at its edges.

 

[5 36 -0.8 0.7]

A negative density makes the aperture transmit more light at its center.

 

[5 36 -0.8 -0.7]

We can also modify the eccentricity of the "ellipse of confusion"--the region on the film plane hit by samples from an object that is not in focus--using the dofaspect parameter. A value greater than 1 makes the blur bigger horizontally (e.g., 2.0 here):

A value between 0 and 1 makes the blur bigger vertically (e.g., 0.5 here). This emulates the oval-shaped defocus blur produced by an anamorphic lens.

Though not directly controllable as a setting, it's worth noting that when a source of light gets close in size to the circle of confusion, its shape will also begin to have a significant effect on the shape of the bokeh. For example, if we had seen a larger square instead of a tiny point through the default circular aperture, the bokeh would be shaped like this (shown without tonemapping in order to emphasize the shape):