LuxCore icon indicating copy to clipboard operation
LuxCore copied to clipboard

Feature Request: Non-Uniform Bokeh Support

Open rrubberr opened this issue 6 years ago • 9 comments

In LuxRender, the camera offered support for "Non-Uniform Bokeh Distribution," which allowed the user to set the distribution, number of aperture blades, and power of the distribution. According to the luxrender.net wiki:

"LuxRender also allows for some modifications to the distribution of light across the focus disk or circle of confusion. The distribution and quality of this light is generally called bokeh. This is achieved through the blade number and distribution parameters. Blade number is the number of blades that make up the iris of a lens. A blade number of zero simulates an infinite blade number of a perfect circle, and will result in bokeh disks that are circular... As no lens distributes light uniformly across the focus disk, some non-uniformity is desirable for photorealistic imaging."

(https://web.archive.org/web/20161014045454/http://www.luxrender.net/wiki/LuxRender_Cameras)

Here is an example of the feature present while using LuxRender 1.2.1 in the Blender 2.65a interface:

Capture

This feature was useful in practice, as it allowed users to create much more realistic and high quality bokeh, without resorting to complex setups requiring the use of translucent bokeh images or the compositor. Below I have created some examples using the different distributions, showing their usefulness to generate certain effects.

6 bladed exponential distribution with power 1: 6Blades

22 bladed inverse exponential distribution with power 10: 22inverse

0 bladed (perfectly round) aperture with uniform distribution and power 0 (perhaps the sort of DoF LuxCore is capable of?): uniform

22 bladed aperture with exponential distribution and power 1: FinalTS_pregamma_1_mantiuk08_auto_luminance_color_saturation_1_contrast_enhancement_1_postsaturation_1_postgamma_1

Implementing this feature into LuxCore would be useful. Thanks!

rrubberr avatar Jul 20 '20 20:07 rrubberr

I have a vague memory it was an image post processing feature and not a real camera option. Do you have an LXS file using this feature ? I should be able to track back what it was.

Dade916 avatar Jul 21 '20 09:07 Dade916

It's not a post processing feature, check https://github.com/LuxRender/Lux/blob/3550ad33f0d5a3f2a6c5fe435e4a853088db82a5/cameras/perspective.cpp#L326

Theverat avatar Jul 21 '20 10:07 Theverat

Right, the one I remember was lens flares. This one should be quite easy to add.

Dade916 avatar Jul 21 '20 10:07 Dade916

Awesome, I have been waiting for this!

While looking at the bokeh shape, please consider supporting lateral and longitudinal chromatic aberration, the possibility to use a custom bokeh image, and optical vignetting.

michelchafouin avatar Jul 21 '20 16:07 michelchafouin

Do you have some links to information that would help implement all of this, by chance?

Theverat avatar Jul 21 '20 18:07 Theverat

I don't have any white-paper, but someone recreated it physically in Cycles (spoiler: it's extremely slow to render): https://blenderartists.org/t/advanced-optical-experiments/695835 This page explains well the different lens effects: http://richardrosenman.com/shop/dof-pro/

michelchafouin avatar Jul 21 '20 20:07 michelchafouin

I'm working on it:

bokeh

Dade916 avatar Jul 22 '20 12:07 Dade916

Done: https://forums.luxcorerender.org/viewtopic.php?f=5&t=2374

Dade916 avatar Jul 23 '20 13:07 Dade916

While looking at the bokeh shape, please consider supporting lateral and longitudinal chromatic aberration, the possibility to use a custom bokeh image, and optical vignetting.

@michelchafouin, I added the support for lateral and longitudinal chromatic aberration, it only requires to use two parameters instead of one:

film.imagepipelines.5.0.type = COLOR_ABERRATION
film.imagepipelines.5.0.amount = 0.025 0.005

Dade916 avatar Jul 27 '20 10:07 Dade916