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.
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.
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!
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:
Enjoy!
Wow it's so impressive you can emulate and make it work a camera obscura in blender.
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-
It would be great if camera shaders could be used in Blender as they are in Arnold. http://www.lentil.xyz/
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!!!!!
Join to leave a comment.