Lentil – Lenses for pathtracers
lentil.xyz
lentil.xyz
e.g. https://blog.demofox.org/2018/07/04/pathtraced-depth-of-fiel...
This does mean that all images are perfectly sharp however, so for depth-of-field, bokeh, and other realistic lens blurring effects the position of the idealized lens (i.e. virtual pinhole) is varied over samples creating a sort of fuzzy pinhole.
From Middle English lentile, from Old French lentille from Latin lenticula, diminutive of lēns, from a Proto-Indo-European root shared by German Linse and Ancient Greek λάθυρος (láthuros). Doublet of lenticula.
In Swedish, for example, the word for the food ("lins") is exactly the same as the word for the optical component. I just thought that was interesting, since naming is hard and perhaps the connection was not obvious to everybody.
They claim to be 30x faster than the Arnold CPU renderer, but of course most people use the GPU renderer, which this tool doesn't support and which is potentially 100x faster.
So they are comparing their main speed claim against an outdated and known slow implementation.
Also, vray (another renderer) ships with a variety of lens shaders and if I recall correctly already decouples main rays and camera focus rays.
What I agree on is that having more realistic lens shaders is great and that they should be fast to calculate. But since doing bokeh in post is good enough for Hollywood movies, I'm not sure if their solution offers a large enough increase in image quality to justify the surely large increase in rendering costs.
1. There are actually around 20 lenses in a camera, not one.
2. A lens converts a ray into a cone, right? And then you need to pass that cone through the other 20 lenses which further modify it's shape, differently at different wavelengths.
I would guess this is extremely computationally expensive done naively.
As to why lenses would cause a problem specifically, I don't know the path tracing algorithm well enough to say for sure offhand, but it may have something to do with introducing random sampling before you even hit the first scene object. Usually in ray tracing the first hit is kind of a freebie; you can calculate direct illumination exactly, and it's only indirect illumination that's approximated. (In path tracing, it's approximated by doing a lot of random sampling.) So, not having to approximate the first-hit direct illumination reduces the noise quite a bit right off the bat.
Also, as a separate matter many implementations optimize around the assumption that the projection from three dimensions to two is done in a uniform, undistorted space. For example the kind of projection that can be fully described by a 4x4 matrix. Changing that assumption loses those optimizations, and generally leads to substance abuse and mayhem.
Most modern render engines render rays from the camera into the scene. This speeds up rendering a lot but also means rendering caustics will need a huge amount of samples because the probability of seeing light from a camera through glass is very low. Bi-directional path tracing fixes some of these problems.
So it can be done but always at a cost (rendering times).
In Blender I have done this a couple of times and even used different IORs for the RGB colors to get real world results.
A photo (or movie) is, however, taken through a lens that distorts the image (sometimes intentionally; what is and isn't in focus in a composition is important for drawing the viewers attention).
A path tracer can already simulate this by just putting a bunch of pieces of glass shaped like the real lenses of a camera, but this is extremely computationally intensive.
This particular implementation uses a few (already known in the literature) techniques for making it faster: bidirectional tracing, selective oversampling, and thin-lens approximations.
This is an implementation of these techniques for Arnold, which is a renderer implementation used for many feature films[1].
Pixar uses RenderMan, which is Arnold's competition.
The video you linked just talks about a shot that was purposely made to be an homage to a classic cinematic technique even though it isn't necessary. Depth of field in production computer graphics is almost exclusively done with depth maps in compositing. Because there are many different layers that won't give seam artifacts around the edges as well as floating point outputs that don't clip, depth maps are even easier to make work.