Real world F-stop DOF

Generic forum to discuss Octane Render, post ideas and suggest improvements.
Forum rules
Please add your OS and Hardware Configuration in your signature, it makes it easier for us to help you analyze problems. Example: Win 7 64 | Geforce GTX680 | i7 3770 | 16GB
User avatar
glimpse
Licensed Customer
Posts: 3740
Joined: Wed Jan 26, 2011 2:17 pm
Contact:

abstrax wrote:One more thing: The aperture is not a fake value, but the radius of the lens opening in cm.
in reality,.. but what is the does the number in Octane Render mean?

manual doesn't explain (give the exact measuring unit) - asked this in other thread (http://render.otoy.com/forum/viewtopic.php?f=73&t=43948)
"Aperture (aperture)
The aperture of the camera in the scene. Choosing a low value will have a wide depth of field where everything is in focus. Choosing a high value will create a shallow depth of field (DOF) where objects in the foreground and background will be out of focus."
(qoute from manual: http://render.otoy.com/manuals/Standalo ... age_id=407)

.. isn't the .25 in aperture the same as having f/4? (I always though so, but I'm starting to doubt..)
martincarlson wrote: ..But is there actually a matemathical formula I can use?
Here's what I've found on wikipedia:
The f-number N is given by
54055628046244c1d76d9f7f52e9455a.png
54055628046244c1d76d9f7f52e9455a.png (480 Bytes) Viewed 4680 times
"where f is the focal length, and D is the diameter of the entrance pupil (effective aperture). It is customary to write f-numbers preceded by f/, which forms a mathematical expression of the entrance pupil diameter in terms of f and N.[2] For example, if a lens's focal length is 10 mm and its entrance pupil diameter is 5 mm, the f-number is 2 and the aperture diameter is f/2."
(source: http://en.wikipedia.org/wiki/F-number)

so, by this, if.. we have radius in Octane Render, then.. let's say on 50mm (focal length) & .25 (as radius - from OctaneRender in cm), 50mm/0.5cm or 50/5 & we get f/10???

what I'm missing here? (this topic got messed today in my head)
would appreciate any help on it =)
User avatar
martincarlson
Licensed Customer
Posts: 319
Joined: Mon Nov 03, 2014 10:18 am
Location: Sweden
Contact:

We're getting closer. But my brain hurts. Aint your formula correct? My only reference point is that I know how a certain aperture at a choosen lens looks like. Kind of.
Martin Carlson, Visual and Audial Designer at Katzenwaffe Creative Studio | www.katzenwaffe.se | Soundcloud | Twitter

Intel Core i7-5930K / ASUS X99-E WS / 2 x EVGA GeForce GTX TITAN X 12GB / 32 GB RAM / Windows 10 / C4D R16 / Octane Standalone 3.03.3 / OctaneC4D 3.03.3-R1
User avatar
abstrax
OctaneRender Team
Posts: 5510
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

glimpse wrote:
abstrax wrote:One more thing: The aperture is not a fake value, but the radius of the lens opening in cm.
in reality,.. but what is the does the number in Octane Render mean?
It's what I said: The aperture value is the radius if the lens opening in cm. You can find descriptions about pins by hovering over them in node inspector.
manual doesn't explain (give the exact measuring unit) - asked this in other thread (http://render.otoy.com/forum/viewtopic.php?f=73&t=43948)
"Aperture (aperture)
The aperture of the camera in the scene. Choosing a low value will have a wide depth of field where everything is in focus. Choosing a high value will create a shallow depth of field (DOF) where objects in the foreground and background will be out of focus."
(qoute from manual: http://render.otoy.com/manuals/Standalo ... age_id=407)
We have now Abby working full time on the manuals. Expect to see some progress in that area soon, but give her some time, since bringing documentation up to speed is a massive task.
.. isn't the .25 in aperture the same as having f/4? (I always though so, but I'm starting to doubt..)
No, it isn't. An aperture of 0.25 means that the lens has an opening radius of 0.25cm, i.e. an opening diameter of 0.5cm. To calculate the opening of a lens using f-stop you also need the focal length, since f-stop = focal length / aperture diameter, i.e. aperture diameter = focal length / f-stop. If you have these two, it also makes sense to add the film width, so you can calculate the field of view from the focal length and the film width. Another reason is that with real cameras you have different film widths / CCD, CMOS chip sizes. So an f-stop of 2.8 and focal length of 50mm, mean something totally different if the film is middle format, full format or APSC for example.

Btw, you can inspect Lua script graphs by switching on the development mode in the application preferences. This is what the camera calculator does and what the relationship between, f-stop, focal length, film width, field of view and aperture is:

Code: Select all

function CamCalculatorScript.onEvaluate(self, graph)

    local inFilmWidth   = self:getInputValue(mInFilmWidth)
    local inFocalLength = self:getInputValue(mInFocalLength)
    local inFstop       = self:getInputValue(mInFstop)
    local outFov      = math.deg(2 * math.atan(inFilmWidth * 0.5 / inFocalLength))
    local outAperture = inFocalLength / inFstop * 0.1
    mOutFov:setAttribute(octane.A_VALUE, outFov)
    mOutAperture:setAttribute(octane.A_VALUE, outAperture)

end
Anyway, we will add f-stop, film width and focal length to the thin lens camera node.

EDIT: Fixed incorrect f-stop calculation.
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
glimpse
Licensed Customer
Posts: 3740
Joined: Wed Jan 26, 2011 2:17 pm
Contact:

ok =) I need to study this first in the morning to have fresh head! =)
Thanks for all the info + useful pointers, Abstrax! It really helps!

& Good luck for Abreukers (Abby) - It's a lot of work with manuals.
User avatar
abstrax
OctaneRender Team
Posts: 5510
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

glimpse wrote:ok =) I need to study this first in the morning to have fresh head! =)
Thanks for all the info + useful pointers, Abstrax! It really helps!
JFYI: I fixed the f-stop calculation in the post above.
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
martincarlson
Licensed Customer
Posts: 319
Joined: Mon Nov 03, 2014 10:18 am
Location: Sweden
Contact:

abstrax wrote:
glimpse wrote:ok =) I need to study this first in the morning to have fresh head! =)
Thanks for all the info + useful pointers, Abstrax! It really helps!
JFYI: I fixed the f-stop calculation in the post above.
Thanks! Maybe I can turn this into a Excel-calculator of som sort in the meantime.
Martin Carlson, Visual and Audial Designer at Katzenwaffe Creative Studio | www.katzenwaffe.se | Soundcloud | Twitter

Intel Core i7-5930K / ASUS X99-E WS / 2 x EVGA GeForce GTX TITAN X 12GB / 32 GB RAM / Windows 10 / C4D R16 / Octane Standalone 3.03.3 / OctaneC4D 3.03.3-R1
User avatar
martincarlson
Licensed Customer
Posts: 319
Joined: Mon Nov 03, 2014 10:18 am
Location: Sweden
Contact:

I'm working on my Excel-calculator and I'm pretty close. I think.

Check it out and help me test it. Made in Numbers since I'm on Mac. Also exported Excel-document but can't verify that the formulas work.

EDIT:
Latest here: http://render.otoy.com/forum/viewtopic. ... 20#p220652
Last edited by martincarlson on Mon Feb 02, 2015 8:49 am, edited 1 time in total.
Martin Carlson, Visual and Audial Designer at Katzenwaffe Creative Studio | www.katzenwaffe.se | Soundcloud | Twitter

Intel Core i7-5930K / ASUS X99-E WS / 2 x EVGA GeForce GTX TITAN X 12GB / 32 GB RAM / Windows 10 / C4D R16 / Octane Standalone 3.03.3 / OctaneC4D 3.03.3-R1
User avatar
linvanchene
Licensed Customer
Posts: 783
Joined: Mon Mar 25, 2013 10:58 pm
Location: Switzerland

martincarlson wrote:I'm working on my Excel-calculator and I'm pretty close. I think.

Check it out and help me test it. Made in Numbers since I'm on Mac. Also exported Excel-document but can't verify that the formulas work.
It seems the result of the aperture field in the excel sheet is off by a factor of 10.
I believe instead of

=B6/B7*0.1

you can just use

=B6/B7

Then you get the Aperture Diameter.
If all values are using the same unit mm I do not see any reason why there would be a multiplication by the factor 0.1.

The question then is why is the formula Abstrax posted also using the *0.1 factor? :?:

Code: Select all


    local outAperture = inFocalLength / inFstop * 0.1
    
Maybe not all variables are using the unit mm in OctaneRender?

- - -

I compared the results of the excel sheet to a table of apertures found on website that seems to explain the relationship between F-stop and Aperture in a very informative way:


A Tedious Explanation of the f/stop

by Matthew Cole

http://www.uscoles.com/fstop.htm


- - -

To summarize this from my end:

The source of the confusion may have been that in loose terms the aperture is a hole or an opening through which light travels.

I could not find any source that says when someone is talking about the aperture he always means the radius, the diameter or the area.


Therefore when talking about "the Aperture" it is important to indicate if we are talking about the Radius, the Diameter or Area of the opening trough which the light enters into the camera.


For mathematical purposes we also must make sure to use the proper units:

Diameter of aperture (mm)
Radius of aperture (mm)
Area of Aperture (square mm)

- - -
- - -

@ Field of View calculation

I compared with this online caculator

http://www.tawbaware.com/maxlyons/calc. ... calculator

and got also different result.

It seem the FoV formula in the excel sheet is too much of a simplification.

α = d/2f

I still have not figured out based on which assumptions people are leaving out the arctan and the multiplication of it by 2.

compare:

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

Based on the wiki pages I expected to see used the formula

α = 2 arctan d/2f

f = focal lenght (mm)
d = film or sensor size (mm)

That seems to be similar to the one Abstrax posted as well:

Code: Select all


    local outFov      = math.deg(2 * math.atan(inFilmWidth * 0.5 / inFocalLength))
In any case I allready chewed trough that one in August 2014.

http://render.otoy.com/forum/viewtopic. ... 99#p200299

Maybe those calculation examples posted there help. Maybe they will just confuse more.

When comparing different render engines and how they calculate the field of view the main issue seems to be how "d" is defined and based on which assumptions the formula is simplified. :!:

Update/Edit:


Some render engines seem to use a different value of d based on if you render out images in horizontal or vertical aspect ratios.
Some render engines also keep d as a fixed value always.


In any case when it comes to the variable "d" it also seems important to always indicate for which exact variable it stands for and based on which assumptions or simplifications the specific value is used.

- - -

Update / Edit:
I hope I removed all the typos now.
:roll:
Last edited by linvanchene on Wed Jan 28, 2015 12:05 pm, edited 4 times in total.
Win 10 Pro 64bit | Rendering: 2 x ASUS GeForce RTX 2080 Ti TURBO | Asus RTX NVLink Bridge 4-Slot | Intel Core i7 5820K | ASUS X99-E WS| 64 GB RAM
FAQ: OctaneRender for DAZ Studio - FAQ link collection
User avatar
abstrax
OctaneRender Team
Posts: 5510
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

linvanchene wrote:...
The question then is why is the formula Abstrax posted also using the *0.1 factor? :?:

Code: Select all


    local outAperture = inFocalLength / inFstop * 0.1
    
Maybe not all variables are using the unit mm?
Yup, the aperture is given in cm. This decision was made long ago. Don't ask me why.

Need to check in the code if it's actually the radius or diameter. Depending on this either the pin description is wrong or the cam calculater (i.e. off by a factor of 0.5).
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
abstrax
OctaneRender Team
Posts: 5510
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

Ok, I checked it and the pin description is correct and the aperture pin specifies the radius and not the diameter. I will fix the camera calculator and also post the results with a real world experiment. Sorry for the hassle.

The calculation in the Lua script graph will change to (factoring 0.5 to convert from diameter to radius):

Code: Select all

function CamCalculatorScript.onEvaluate(self, graph)

    local inFilmWidth   = self:getInputValue(mInFilmWidth)
    local inFocalLength = self:getInputValue(mInFocalLength)
    local inFstop       = self:getInputValue(mInFstop)
    local outFov      = math.deg(2 * math.atan(inFilmWidth * 0.5 / inFocalLength))
    local outAperture = inFocalLength / inFstop * 0.05
    mOutFov:setAttribute(octane.A_VALUE, outFov)
    mOutAperture:setAttribute(octane.A_VALUE, outAperture)

end
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
Post Reply

Return to “General Discussion”