Advanced カメラ Modeling

Advanced カメラ Modeling

January, 2006 (Revised: November, 2010)

1   Introduction

Most computer graphics is done with an extremely simple camera model, as though we were using a pinhole camera with an instantaneous exposure (and infinitely fast film!). RenderMan's depth of field and motion blur capabilities allow for a relatively sophisticated camera model, one that models the finite aperture and exposure time of real cameras. Still, the RenderMan camera model is, by comparison with real optical systems, fairly simple. The lens aperture must be regular, illumination of the film plane is constant across the surface of the lens and the shutter opens and closes according to a parametric curve.

This application note provides examples for the use of the more advanced parameters of the RenderMan camera model to provide more control of the lens aperture shape and radial falloff and to allow the shutter to open and close at variable speeds over finite intervals.


2   The レンズ Model

images/cameraBokeh.png

Bokeh, created by manipulating the aperture

The lens shape is controlled by the aperture hider option:

Hider "hidden" "float[4] aperture" [nsides angle roundness density]

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.

FrameBegin 0
  Format 300 300 1
  PixelSamples 31 31
  Display "aperture1.tif" "it" "rgb"
  Projection "perspective" "fov" [15]
  Translate 0 0 8
  DepthOfField 2 8 10
  Hider "hidden" "float[4] aperture" [0 0 0 0]
  WorldBegin
    # make point VERY bright so that each lens sample is readily visible
    カラー [1000 1000 1000]
    Points "P" [0 0 0] "width" [0.01]
  WorldEnd
FrameEnd

Yielding this image:

images/figures.cameramodel/aperture1.jpg

By modifying the aperture values in the Hider call, we can produce a range of aperture effects, such as Bokeh (note that Depth Of Field must be enabled for Bokeh effects):

Hider "hidden" "float[4] aperture" [5 0 0 0]

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

images/figures.cameramodel/aperture2.jpg

Hider "hidden" "float[4] aperture" [5 36 0 0]

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

images/figures.cameramodel/aperture3.jpg

Hider "hidden" "float[4] aperture" [5 36 0.5 0]

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

images/figures.cameramodel/aperture4.jpg

Hider "hidden" "float[4] aperture" [5 36 -0.8 0]

A negative roundness makes the sides of the pentagon bow inward.

images/figures.cameramodel/aperture5.jpg

Hider "hidden" "float[4] aperture" [5 36 -0.8 0.7]

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

images/figures.cameramodel/aperture6.jpg

Hider "hidden" "float[4] aperture" [5 36 -0.8 -0.7]

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

images/figures.cameramodel/aperture7.jpg

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:

Hider "hidden" "float dofaspect" [2.0] images/figures.cameramodel/aperture8.jpg

A value between 0 and 1 makes the blur bigger vertically:

Hider "hidden" "float dofaspect" [0.5] images/figures.cameramodel/aperture9.jpg

This emulates the oval-shaped defocus blur produced by an anamophic lens.


3   The シャッター Model

シャッター opening and closing rates are controlled by the shutteropening Riカメラ option. The shutter interval is determined by the values passed to Riシャッター.) In shutter-normalized time, the shutter interval is mapped to [0,1]. The basic version of the shutteropening option takes two parameters in this time:

カメラ "world" "float[2] shutteropening" [opentime closetime]

The shutter begins opening at time 0. The opentime is the time at which it becomes fully open. Between opentime and closetime the shutter remains fully open. At closetime, it begins closing, and it fully closes at time 1.

This rib file specifies a blue sphere moving from the screen left to screen right. The camera shutter opens and closes instantaneously, which is the default behavior if shutteropening is not given. The sphere is made artificially bright so that its blur shows up more.

FrameBegin 0
  Format 512 256 1
  PixelSamples 9 9
  Display "shutter1.tif" "it" "rgb"
  Projection "perspective" "fov" [15]
  シャッター 0 1
  Translate 0 0 18
  カメラ "world" "float[2] shutteropening" [0.0 1.0]
  WorldBegin
    MotionBegin [0 1]
      Translate -3.5 0 0
      Translate 3.5 0 0
    MotionEnd
    カラー [0.6 1.5 3]
    Sphere 1 -1 1 360
  WorldEnd
FrameEnd

Because the shutter is completely open during the entire shutter interval, the motion samples are uniformly distributed, giving a constant blur:

images/figures.cameramodel/shutter1.jpg

By modifying the shutteropening parameters to [0.0 0.0], we can make the shutter still open instantaneously, but then spend the time between 0 and 1 closing at a constant speed. This generates the most samples at the beginning of the sphere's motion, at screen left, and gradually fewer samples as it moves across the screen, making the blur fade out to screen right.

images/figures.cameramodel/shutter2.jpg
カメラ "world" "float[2] shutteropening" [0.0 0.0]

Having this shutter spend the entire interval opening and then close instantaneously reverses the image and the blur fades in over the sphere's motion.

images/figures.cameramodel/shutter3.jpg
カメラ "world" "float[2] shutteropening" [1.0 1.0]

Since real camera shutters cannot move infinitely fast, they generally spend some nonzero amount of time opening, remain open for a bit, and then spend some nonzero amount of time closing. We can model this by having the shutter opening between 0 and 0.35, fully-open between 0.35 and 0.65, and closing between 0.65 and 1.

images/figures.cameramodel/shutter4.jpg
カメラ "world" "float[2] shutteropening" [0.35 0.65]

To approximate a real camera shutter even more accurately, we can relax the restriction that it opens and closes at a constant rate and model the acceleration of the shutter as it begins to open and the deceleration as it reaches its fully open or fully closed position. For this we need a more complex parametric description:

カメラ "world" "float[10] shutteropening" [opentime closetime c1 c2 d2 d2 e1 e2 f1 f2]

The first two parameters, opentime and closetime are the same as the simpler version of shutteropening; they are the times at which the shutter becomes fully open and at which it begins to close. The subsequent eight parameters represent four points on a graph representing the motion of the shutter:

images/figures.cameramodel/shutteropening.jpg

The points c1,c2 and d1,d2 must lie in the axis-aligned rectangle with corners at (0,0) and (opentime,1) and are the control points of a bezier curve segment. Likewise, e1,e2 and f1,f2 are control points of a bezier curve between (closetime,1) and (1,0) and must lie in the axis-aligned rectangle with corners at those points. In addition, the bezier curve itself must be a function, i.e. its slope must never be infinite within the defined segment.

Here are images of the shutter taking the entire interval to open. The first is the same as before, with the shutter opening at a constant rate. The second bends the bezier curve segment down to make the shutter open very slowly at first and accelerate throughout the opening interval, going very fast at the point that it finally becomes fully open. This moves the distribution of motion samples even more towards the end of the shutter interval, so the streak at the beginning of the interval is less pronounced and it becomes brighter more sharply.

images/figures.cameramodel/shutter3.jpg
カメラ "world" "float[10] shutteropening" [1 1 0 0 1 1 1 1 1 1]
images/figures.cameramodel/shutter5.jpg
カメラ "world" "float[10] shutteropening" [1 1 0.8 0.1 0.9 0.2 1 1 1 1]

The sharper shutter opening curve preserves more of the static shape of the moving object and can be more aesthetically appealing.