# dof, circle of confusion

## Recommended Posts

hello!

i want to visualize real camera settings in houdini, such as focus distance, near and fa dof. formulae to calculate the limits of dof is simple - we should know focus distance, focal length, f/stop and the diameter of the circle of confusion. camera object in houdini includes all of these parameters except circle of confusion. does anybody know, how houdini calculates the dof distance limits - maybe it is constant (diameter of circle of confusion), smth like 0.03 mm, for example..?

##### Share on other sites
hello!

i want to visualize real camera settings in houdini, such as focus distance, near and fa dof. formulae to calculate the limits of dof is simple - we should know focus distance, focal length, f/stop and the diameter of the circle of confusion. camera object in houdini includes all of these parameters except circle of confusion. does anybody know, how houdini calculates the dof distance limits - maybe it is constant (diameter of circle of confusion), smth like 0.03 mm, for example..?

I don't think Houdini's camera is a physical camera like in vray or other systems offers them.

It's more like the mental ray one - if we want to compare it - where the values have no physical correspondence.

Sometimes I can enter a viewport mode where Houdini shows geometry in focus a shaded and the rest is wireframe ... but this is my personal circle of confusion ... how to enter this mode.

##### Share on other sites
Sometimes I can enter a viewport mode where Houdini shows geometry in focus a shaded and the rest is wireframe ... but this is my personal circle of confusion ... how to enter this mode.

hmmm, sorry, i don't understand you....

here are the wiki articles:

http://en.wikipedia.org/wiki/Depth_of_fiel...he_DOF_formulas

http://en.wikipedia.org/wiki/Circle_of_confusion

in first we can see the formula:

D_{\mathrm N} = \frac {s f^2} {f^2 + N c ( s - f ) }

and

D_{\mathrm F} = \frac {s f^2} {f^2 - N c ( s - f ) }\,.

for the near and far dof.

(f = focal length, s = focus distance, N = f/stop, c = circle of confusion)

I suppose Houdini uses this formula with some constant or calculated circle of confusion!

for example, in the second article CoC is calculated using film size, 0.029 mm for 35 mm film..

##### Share on other sites
hmmm, sorry, i don't understand you....

here are the wiki articles:

http://en.wikipedia.org/wiki/Depth_of_fiel...he_DOF_formulas

http://en.wikipedia.org/wiki/Circle_of_confusion

in first we can see the formula:

D_{\mathrm N} = \frac {s f^2} {f^2 + N c ( s - f ) }

and

D_{\mathrm F} = \frac {s f^2} {f^2 - N c ( s - f ) }\,.

for the near and far dof.

(f = focal length, s = focus distance, N = f/stop, c = circle of confusion)

I suppose Houdini uses this formula with some constant or calculated circle of confusion!

for example, in the second article CoC is calculated using film size, 0.029 mm for 35 mm film..

For an answer to how the CoC is calculated internally in Houdini, I would email support, since I doubt anyone except the programmers themselves would know the answer (I certainly don't).

What puzzles me is why you'd think that they'd use a constant since, given the two equations you posted, it can clearly be expressed in terms of the other variables:

c_near = -f2 (s - DN) / N (f - s) DN

c_far = f2 (s - DF) / N (f - s) DF

But again, I'd email support for an exact response to these questions...

##### Share on other sites
Sometimes I can enter a viewport mode where Houdini shows geometry in focus a shaded and the rest is wireframe ... but this is my personal circle of confusion ... how to enter this mode.

This is achieved by invoke the Camera's handles (hitting Enter in viewport with Camera selected) and then RMB on the handle and then choosing "Focus Frustum Clipping", and switching to shaded mode in the viewport. Quite honestly I can't get this to work anymore in H9.5.281 - does it work for you?

As for the DOF/CoC thing, when they supported rendering out DOF in the Flipbook (have you seen that? Under Effects in the flipbook popup menu), I was hoping it'd be added as a native viewport viewing mode and we'd be able to move around the scene with it engaged. (Anyone wish for that too?) If you watch how this works, it moves the camera around in a circle with the pivot around the focus point.

Cheers,

Jason

##### Share on other sites

Ok that flipbook DOF thing is way too cool!

Yes I would vote for that as a viewport christmas wish.

##### Share on other sites

to Mario -> i wanted the visualisation of D_near and D_far, so they are calculated using CoC, not in inversed way =)

to Jason -> sorry, but does it work in 9.1.244 ?.. and about feature - yes of course)

and about CoC in Renderman Documentation:

If depth of field is turned on, points at a particular depth will not image to a single point on the view plane but rather a circle. This circle is called the circle of confusion.

The diameter of this circle is equal to

C = focallength/fstop * focaldistance*focallength/(focaldistance-focallength) * (1/ depth - 1/ focaldistance)

and

http://www.renderman.org/RMR/Examples/dof/index.html

maybe mantra thinks the same?)

##### Share on other sites

so, am i right in this assumption:

when DOF is on, CoC is calculated everywhere, and it's diameter depends on the depth. (like in renderman formula) So, some 'defocus' is everywhere, but in some places it is unvisible - like the real camera (only objects in focus distance are 'in focus', all other are blured, but, cause of the very little CoC, there are some DOF, where our eye or the film can't see it). So, if i want to visualize the DOF, for example, i should use the 'limit CoC' value, which coresponds the max blur i don't notice.. hope you undestand my thought..)

Edited by mic

##### Share on other sites
hope you undestand my thought..)

To be honest I don't get the point.

Can you post some example what this is all about?

Cheers,

Georg

##### Share on other sites
To be honest I don't get the point.

Can you post some example what this is all about?

Cheers,

Georg

hmm, i don't think the scene is useful)

so, we have Depth of Field = On in our ROP. (renderman or mantra). In real life only points that are located exactly at the distance = focusdistance are 'in focus', they project on the film as a point, all other projects as a circle, called circle of confusion. and it's diameter is calculated like the formula from renderman documentation. in computer graphics - all the same. the CoC is calculated according to the distance to object, when it equals the focusdistance, CoC = 0. so, the Depth of Field - is the area, where CoC is not very much, where the diameter of this circle is really small, and we don't notice it. for example, in 35 mm film, this limit of visible CoC is 0.029 mm. so again, the Df and Dn, which were calculated upper, depends on the critical size of the CoC.

##### Share on other sites
hmm, i don't think the scene is useful)

so, we have Depth of Field = On in our ROP. (renderman or mantra). In real life only points that are located exactly at the distance = focusdistance are 'in focus', they project on the film as a point, all other projects as a circle, called circle of confusion. and it's diameter is calculated like the formula from renderman documentation. in computer graphics - all the same. the CoC is calculated according to the distance to object, when it equals the focusdistance, CoC = 0. so, the Depth of Field - is the area, where CoC is not very much, where the diameter of this circle is really small, and we don't notice it. for example, in 35 mm film, this limit of visible CoC is 0.029 mm. so again, the Df and Dn, which were calculated upper, depends on the critical size of the CoC.

Aha.

So you want do set this depending on Coc, Df and Dn instead of Focus Distance and a F-Stop?

##### Share on other sites
Aha.

So you want do set this depending on Coc, Df and Dn instead of Focus Distance and a F-Stop?

no, i wanted only to visualize the areas of DOF- to place parented to camera parts of spheres or planes in the DF abd DN distances away of camera, and they (DF and DN) are calculated using focus_distance, fstop, focal_length and that 'critical' value of CoC.

but as you said this is the unneccesairy work, cause houdini can show the DOF in wireframe/shaded mode, which is much more visual =)

it's a pity that in my 9.1.244 this useful feature doesn't work)))

##### Share on other sites

super-necro, but to get the camera visualizations that were asked about you select the camera, hit enter in the viewport and hit "z" "o" and "f" to toggle through the focus and clipping visualizations...  this isn't listed in the docs for some reason (just submitted an RFE)

• 1

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account