Camera DOF

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Post Reply
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Camera DOF

Post by CodeHD »

I just tried setting up a scene with a DOF effect, but I couldn't get it to work properly. Attached is an example scene with a series of cubes progressively further away from the camera.

I only get a blurred image if I either set the F-stop as low as possible (0.01) or if I set the focus distance extremely close (something like 1).
For a distant focus, all objects are sharp (except at F-stop = 0.01).

With I simple setup like this it always feels like I am missing something trivial... Any help?
(Both v2.1 stable and daily build tested.)
Attachments
fstop_error.blend
(530.54 KiB) Downloaded 130 times
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Camera DOF

Post by Dade »

F-stop has nothing to do with DOF, it is a tone mapping parameter, focal distance and lens radius are the important parameters, did you changed the lens radius ?
Support LuxCoreRender project with salts and bounties
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Camera DOF

Post by CodeHD »

I can't see a lens radius setting (in Blender). There is only F-stop in teh depth of Field section of the camera settings. it has the tool tip: "Aperture, lower values result in a stronger depth of field effect"
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Camera DOF

Post by CodeHD »

I found this line of code in the BlendLuxCore source:

Code: Select all

definitions["lensradius"] = (camera.data.lens / 1000) / (2 * camera.data.luxcore.fstop)
so I'm not missing the radius in blender. The formula also seems correct, assuming that LuxCore calculates in meters and Blender in mm.
Could this be the error? It would explain why you need extremely small f-stop values for an effect, as they would be off by a factor of 1000
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Camera DOF

Post by B.Y.O.B. »

Your camera is 500 m away from the nearest cube, and 1 km from the farthest.
You are using a 50 mm lens.
I think the DoF effect you get is correct, in the real world you wouldn't get much of a DoF effect either with this kind of setup.

Possible solutions:
- scale down the scene
- move the camera closer to the focal object (e.g. put it 5 meters away, not 500)
- use more tele (e.g. a 600 mm lens)
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Camera DOF

Post by CodeHD »

Ok if Luxcore assumes the natural units of Blender to be metres that makes sense. But normally they are supposed to be mm, at least that is how all CAD import/export behaves.
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Camera DOF

Post by B.Y.O.B. »

1 Blender unit is by default 1 meter (but this is not LuxCore specific, it's the same for Cycles).
You can specify a unit scale, but usually I would not do this (you sign up as a bug finder for really rare and hidden bugs if you do it ;) ).
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Camera DOF

Post by CodeHD »

After a quick test suggest to me that it is more a Blender thing than related to LuxCore.

- If I create a cube in default-units after I start Blender and set its size to "20" and export as stl I get a 20mm cube.
- I switch units to mm. It shows me the cube is "2cm". I export stl, get 20mm cube
- I switch units to cm, It shows the cube is "20cm". I export as stl, but still get a 20mm cube. (Also happens when I create a new cube after switching units).

Not really the behaviour I expected, but at least I no know a bit better how to get LuxCore to do what I want ;)
So thanks for the help!

Edit: Ok after a bit more testing and reading up on file formats this is not so surprising anymore, although the export discrepancy between cm and mm could be annoying in practice ;)
I guess I was just used to a combination of factors that made everything work for me so far
Post Reply