Cycles Experiment: Pinhole Camera

obscura3

Not much to look at is it? But it was an interesting experiment. The idea was to push cycle’s physical realism to the absurd extreme of building a pinhole camera in blender. A pinhole camera has no lens or aperture, instead the light just passes through a small hole in the front of the camera, and forms an inverted image on the camera’s back wall (this is why the image above appears upside-down). The construction of a pinhole camera is very simple – it’s a box with a hole in one side, so I figured that because Blender now has a physically accurate ray-tracer in the form of Cycles, it was probably possible to build one that worked in blender. Here’s how mine looked:

PinhileCamSetup
The “real” camera – i.e. a Camera object for rendering, is situated inside the pinhole camera, facing the back wall. The scene needed to be lit extremely brightly, in order for enough light to find it’s way through the tiny hole in the camera, to illuminate the back wall. The two lamps have intensities of 100,000 of the key light and 20,000 for the fill light. The cycles preview outside the camera looked something like this:

Screen Shot 2013-03-04 at 10.40.27
As you can see from the final render, the results are very noisy. Even more so when you consider that the small, noisy image you see is the result of 100,000 samples. I set the number of bounces to bounces for rendering to 3 (i.e. one bounce direct lighting, one for a small amount of indirect lighting, plus one extra bounce because we are viewing everything on the diffuse surface of the inside of the camera). It was actually really quick to render, as it was only a small image, and a relatively simple one at that ignoring the rather strange setup. It took about an hour, the only post processing I did was to brighten the image a bit.

Whilst the final result isn’t that impressive, you can clearly make out suzanne and the cube and cone. You can also see that the image is slightly blurry. With pinhole cameras there is no depth of field; instead the focus of the whole image is determined by the size of the pinhole – the smaller the hole the sharper the image. Of course the smaller you make the pinhole, the less light gets in, and so the dimmer the image becomes. This also means that for our virtual pinhole camera we get more noise if we try to bump the image up to the same brightness, so there is a tradeoff between noise and sharpness that we have to take into account.

Anyway, it’s hardly a useful way to go about creating images, but it is an interesting experiment, and a great demonstration of what cycles can do.

You can download the blend file to have a go with it yourself from blendswap (CC-Zero).

14 responses to “Cycles Experiment: Pinhole Camera

  1. This is really interesting.
    with physical making so much sense, I would wonder where the exposure time, and the film ISO could fit in. I know there is a film exposure parameter, yet I’m not quite sure how it works and so far if you can find some kind a match with ISO, you would still need an aperture speed settings. I don’t know if this is possible.

    F.

  2. Pingback: Cycles Experiment: Pinhole Camera | BlenderNation·

  3. Would be interested in trying to create a laser light. Creating the mirrors, the light, and then then pinhole… could be another interesting project

  4. This is fantastic, I loved pinhole cameras when they were taking pictures of model railroads.
    They looked so real. This is a really great experiment. Pushing Blender beyond the “box” ( of normal ).

  5. You should be able to adjust exposure instead of relying on really bright lighting.
    It’s also more physically accurate since pinhole cameras take much much longer exposure time in comparison to a standard camera.

    • Hmmm. Now that I’ve thought about it, there shouldn’t be any diffraction pattern. A ray is ray not a wave.

  6. Of all the cycles experiments I’ve seen, this is hands down the best and most fun! Oddly one of my kids brought a pin hole camera they made a school yesterday

    Bravo.

  7. I’ve had a go at adapting this by increasing the aperture of the box and fitting a simple single element glass lens to the front thus making a simple box camera. The results were as one would expect. Next going to try re-creating my Symmar-s lens!

  8. Yes, very impressive. I’m amazed at what Cycles can do in terms of physical optics. I had a go at this experiment, and also tried a large aperture with a lens (modified sphere with Glass shader). I had to crank up the lights to absurd values, and set samples to something like 1000 – but my CPU overheated!

  9. Pingback: Pinhole Camera Trick in Blender | Motion Graphics and Compositing Craftsman Blaine Morehead·

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s