Films Training Blog
Pipeline and Tools Characters
Pipeline and Tools Characters
search Login Join
favorite

Development Fund

Support Blender Core Development with a monthly contribution.

theaters

Blender Studio

The creators who share. Access production content and knowledge from the Open Movies.

code

Blender Developer Blog

Latest news and updates on Blender development.

people

Get Involved

Join the community and help with design, development, docs and more.

bar_chart

Open Data

A platform to collect and display the Blender Benchmark results.

menu_book

Blender Docs

Documentation on Blender's features, tools and API.

Blender Conference

The yearly event that brings together the Blender community in one place.

download

Get Blender

Download the latest Blender version, or try the beta!

Films
Training
Blog
Pipeline and Tools
Characters
Search
Login
Join

3rd Feb 2023

Simulating Physical Camera Lenses with Caustics

Andy Goralczyk

Author

flag Report Problem

It all started with me wanting to learn more about how physical camera lenses work. I browsed for some diagrams online to see how to construct a simple lens. Next, I started modeling some lens elements and minutes later I found myself in a rather strange rabbit hole.

A first test with a moving camera and shifting focus. It shows very interesting flaring and light leaking.

After some initial noodling around with the render settings in cycles, I had a working setup. I enclosed my “physically based” lens in a camera body and added a translucent plane as a sensor to focus the rays. This in turn gets rendered by an upside-down orthographic blender camera to capture the final image. A circular opening in the middle of the lens (with a shape-key to vary its size) serves as aperture.

The idea itself is nothing new, and quite a few people managed to get mind-blowing results. But the recent improvements to Cycles left me wondering if this is feasible for rendering animations.

The lenses are enclosed in a black box to only let in rays pass through the lens onto the sensor plane
The lenses are enclosed in a black box to only let in rays pass through the lens onto the sensor plane

This setup only works when refractive caustics are enabled in rendering, and it needs around 20 transmission bounces to work correctly. You need quite a lot of samples to render a clear image, 3000 - 8000. But even then, I was extremely excited to see lens flaring, light leaking and other physical imperfections show up in the renders!

Since I’m not that knowledgeable in optics and mathematics, this is all very unscientific. I am sure the lenses are a little out of proportion. I picked the values that seemed right, which sometimes made me feel like a caveman holding shards of volcanic glass into the sun and burning myself in the process!

There are quite some limitations of this crude camera: For example, the lens has a fixed angle of view. The focus range isn’t that great, either. In an earlier test I tried to simulate chromatic aberration by combining the R, G and B channels of different glass materials with diverging indices of refraction together, but it was a little bit cumbersome to get it physically correct (ie. Sergey certified!). All in all, this is not entirely practical for use in production. But I learnt a lot about optics and most importantly it shows how far the development has come in cycles to make this remotely possible!

A tour of the camera controls in the example file. This file uses the Asset Demo by Simon and Julien.

I bundled up my explorations in a single file. The camera is rigged and ready to play around with: There is a bone for focus control and the main root bone has two properties to control lens aperture and sensor gain. You'll need Blender 3.5 Alpha

Download the file here: caustics_lens_example.blend

Enjoy!

Andy Goralczyk

Author

flag Report Problem

3 Comments

Join to comment publicly.

Jesús Odremán

3rd February 2023 - 22:32

Dear Andy Goralczyk. It is great news for me this experiment you have conducted. And that you expose in the article, I am a devoted worshipper of Vintage optics, which I use years ago with my Canon DSLR and now with my BMPCC6k. In Blender a few years ago there was an addon for version 2.98 that did awesome things: it was called "Real Camera" and allowed to simulate with Bokeh and color aberrations in Blender, I loved it.... I'm going to take advantage of the blend you share to play around with the beautiful camera obscura you made. Thank you very much!!!!!

KNAO

4th February 2023 - 13:17

It would be great if camera shaders could be used in Blender as they are in Arnold. http://www.lentil.xyz/

De Etta L Ewing

19th February 2023 - 22:59

I expanded the video file above to watch and get a full screen view, your final scene has the same airiness of some of Seurat impressionist work-

Blender Studio

The Creators Who Share.

Facebook Logo Twitter Logo YouTube Logo
  • Films
  • Blog
  • Training
Pipeline and Tools
  • Cloud Rig
  • Blender Kitsu
  • Contact Sheet Add-on
  • Blender Purge
  • Blender Cloud Services
Characters
  • Einar
  • Security Bot
  • Huginn
  • Pack Bot
Studio
  • Terms & Conditions
  • Privacy Policy
  • Contact
  • Remixing Music
  • Blender.org
Loading...