I don't think I understand DoF

Started by Brrrt, December 10, 2014, 10:40:23 am

Previous topic - Next topic


December 10, 2014, 10:40:23 am Last Edit: December 10, 2014, 10:42:34 am by Brrrt

I was looking at the Fake stones closeup thread and it inspired me to try something like that as well and zoom in on a piece of mountain to see what it does.
So far no satisfactory results.
I wonder what I am doing wrong, since all the results are blurry and they don't even show what is in the camerapreview (yes, I copied view to camera). (And they take forever to render. The attached preview already took over 12.5 hours to render in TG3.1 free on max free settings (1280x900, 0.6 and 4) on my i2370M with 4GB RAM and like 600 MB free during rendering)
I once tried it a few weeks ago with unaltered settings on a landscape and that came out like a macro photo (which looked strange but interesting ;)  )
And another with DoF on [attachurl=2] and off [attachurl=3], but that only generated some shadows on the front of the mountains in the middle. (I had set the DoF goldcoloured border to just above that mountainrange to where the second set of lakes begins).
So how do I use it for closeups? [attachurl=4]
I get blurry images if I include the bits I want to see in focus within the golden highlighted section and before the highlighted section.
I tuned the DoF until it was just outside the golden zone to see if that works, but no satisfying result. And the preview shows that it was in focus (that was what I thought I was doing anyway). [attachurl=5]
I already turned most unused rendernodes off, removed clouds and water and all that and set the atmo quality to low (8).
I feel like giving up on closeups because the rendertimes would exceed 2 days on my system.



DoF is a function of film size, lens aperture, focal length of lens and distance from focus point.

For a large landscape, like in your examples, it is very hard to make DoF visible. Why?
You probably use default fov of 60mm, which has a focal length of 31.1769mm. That's wide angle.
The default focus distance in TG is 100 metres.
The default aperture size is 5 mm and TG tells that the aperture for that setting is f/6.2.

Now let's go to: http://www.dofmaster.com/dofjs.html

For camera type choose a full-frame camera like Canon 5D, because TG's film-size is also "full frame" (36x24mm).
Fill in the form. Choose the settings which resemble TG's settings closest.

Now if you did that correctly you will see in the graph below that at default the DoF is infinite from ~5 meters away from the camera.
Only the first 5 meters is out of focus.
However, since your camera hovers mid-air without anything close to it (in meters) you won't be able to notice DoF at all!


So how to get nice DoF for stones?

First of all: work in real world scales!
If you don't do this then online tools are useless, but also TG's lens shader assumes you're working with real world scales.
So mountains are the size of mountains and not pebbles and vice versa.

So if you have a 1 meter sized stone and want a DoF of 1.5 meters then you can try different things.
A wide angle lens needs to be closer to the stone than a "tele" lens.

The website I just gave you helps with this.

In general: the larger the aperture (the smaller the f-number (f/#)) the smaller the DoF.
A 400mm focal length, @ f/2.8 and @ 10 meters from the stone gives you a DoF of only 10 centimeters!
A 400mm focal length, @ F/45(!) and @ 10 meters from the stone gives you a DoF of 164 centimeters.
(such small apertures barely exist in real life, but to a computer renderer this doesn't matter, because lens shaders aren't inhibited by diffractions like real lenses are)

Another approach is to keep F-number the same, but change distance from camera.
A 400mm focal length, @ f/2.8 and @ 10 meters from the stone gives you a DoF of only 10 centimeters!
A 400mm focal length, @ f/2.8 and @ 37.8 meters from the stone gives you a DoF of exactly 150 centimeters!

Such online tools are key, because you really need to have photography experience to get a sense of what to choose for focal length, distance and aperture.

As you can see now a few factors are at play, but the online tool really helps visualizing them in a quick and easy way.

Next thing for you to figure out is how out of focus background differs between a wide angle lens (small focal length number) vs tele lens (high focal length number).
You'll notice that a tele lens "contracts" the background and makes it all look much tighter, revealing less of the surrounds of the subject.

These are all artistic considerations and choices!



Yes I do understand the concept of DoF on regular cameras.
I just don't understand how that golden zone preview works in TG.
Image1 are my used settings and Image2 is the current rendering.


everything in the brown part will be blurred. The focus point is the border of that line.


Yes my guess too, but I couldn't reproduce the DoF as indicated by the online tool.

I guess that fov/focal lengt might differ because TG may interpret film size as diagonal or horizontal.
I would need to investigate more.


December 10, 2014, 05:32:51 pm #6 Last Edit: December 10, 2014, 05:36:56 pm by Matt
The Depth of Field Preview is a transparent plane that corresponds to the Camera Focus distance. Anything coloured by the plane is further away than the focus distance. This does not mean that everything coloured by the plane is out of focus, and it does not mean that everything not coloured by the plane is in focus. It simply gives you a visual indication of the plane at which perfect focus exists, by showing you where this plane intersects the landscape. To show you this plane, the preview renders a semi-transparent plane that colours everything behind it.

Things can be out of focus if they are significantly closer than the plane or significantly further away than the plane. Things that are coloured by the plane might be in acceptable focus, or they might not, depending on the many things. The range of distances at which things are "acceptably sharp" depends on many things, as in Tangled-Universe's replies.

Just because milk is white doesn't mean that clouds are made of milk.


When these depth of field calculators tell you the total depth of field (the range of distances that are acceptably sharp), they depend on some definition of what "acceptably sharp" means. Unless an object is at exactly the focus distance, some defocusing always occurs, no matter how small. The details of what "acceptably sharp" means are often hidden away in these online calculators. If you render a large image - say 8,000 x 4,500 pixels, then a small amount of defocusing might be noticeable when you look closely at the pixels of the image. But the same render at 800 x 450 might not have enough resolution to show any defocusing at all because it's smaller than a pixel. For this reason, the total depth of field calculated by these calculators shouldn't be used to say precisely where you will start to see defocusing in a render, but can be used to see how other settings increase or decrease the total depth of field.

Just because milk is white doesn't mean that clouds are made of milk.


That's a good and fair point Matt.

To really define what kind of focus is "acceptable" you would need to define the "circle of confusion" I guess, which is a lot more technical.
Also, some calculators keep in mind that defocus in front and behind object differ (1/3rd vs 2/3rd).

In the end these calculators give you an indication of what you can expect (kind of) from starting values in TG. After that you can tweak it to your likings.