Page 1 of 2

cam calculator [fixed]

PostPosted: Sat Dec 13, 2014 10:39 pm
by abstrax
Hi all,

After writing the old school exposure script graph, I thought it may be useful to have a calculator that calculates the field of view and aperture from "old school" camera parameters (film width / focal length / f-stop):
cam_calculator_v2.orbx
(4.11 KiB) Downloaded 764 times


EDIT: The script graph was always calculating the aperture diameter instead of the aperture radius. The aperture pin in the thin lens camera node specifies the aperture radius though. -> I fixed the Lua script graph in this post.

Just download the file and import it into your project (via RMB click in the node graph editor -> Import...) and connect it with the field of view and aperture pins of the camera imager node like:
cam_calculator.png


To knock yourself out you can couple the f-stop of the old school exposure script graph and the cam calculator. Which should give you the ultimate "real camera" feeling with all the disadvantages that come with it:
coupled_fstop.png


Cheers,
Marcus

Re: cam calculator

PostPosted: Sun Dec 14, 2014 12:43 am
by Tugpsx
Very nice, thanks for adding this it will come in handy.

Re: cam calculator

PostPosted: Sun Dec 14, 2014 3:03 am
by p3taoctane
Many thanks

Which should give you the ultimate "real camera" feeling with all the disadvantages that come with it:

Love that part cause it has a lot of truth in it... but of the joys of reality :D

Thanks Abstrax

Re: cam calculator

PostPosted: Tue Jan 27, 2015 11:29 am
by glimpse
wow, Thanks Guys! =)
This will come handy!

Re: cam calculator

PostPosted: Tue Jan 27, 2015 2:47 pm
by glimpse
"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."
(source: http://render.otoy.com/manuals/Standalo ... age_id=407)

so the Question: isn't the .25 in aperture the same as having f/4?

Re: cam calculator

PostPosted: Wed Jan 28, 2015 4:05 am
by linvanchene
glimpse wrote:
"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."
(source: http://render.otoy.com/manuals/Standalo ... age_id=407)

so the Question: isn't the .25 in aperture the same as having f/4?


Update / Edit:
Its seems the source of the confusion is actually what we are talking about when we use the term "aperture". The whole area of the opening? The radius? or the Diameter?
How ever that may be in the F-stop formula the aperture diameter seems to be used.

Update / Edit 2:


In version 2.20 of OctaneRender Aperture is indicated as the radius of the opening trough which light falls.
The OctaneRender aperture value is measuered in cm.

When writing this post I used the formula posted on wikipedia that is based on the aperture diameter and uses the unit mm.

Aperture Diameter = 2 * Aperture Radius
Example: 50mm = 2 * 25mm

value in cm = 0.1 * value in mm
Example: 1 cm = 0.1 * 10mm


- - -

The short answer:

I could asume that you mean 25mm with .25.

Only if you are using a lens with a focal lenght of 100mm an F -stop value of f/4 equals an aperture diameter of 25mm.

- - -

If you really meant to use an aperture diameter of 0.25mm then only if you would be using a lens with a theoretical focal lenght of 1mm an F - stop value of f/4 would equal an aperture diameter of 0.25mm.

- - -
In any case

The F stop value is a ratio between the focal lenght of the lens and the diameter of the lens opening created by the lens blades.

Compare:
http://en.wikipedia.org/wiki/Aperture

- - -
- - -

The longer answer:

First lets have a look at what an aperture is:

The aperture diameter is the diameter of the opening of the lens trough which light enters.
The aperture diameter is measured in the unit mm.
The larger the aperture the more light will enter trough the lens.

The F stop value is a ratio between the focal lenght of the lens and the diameter of the lens opening created by the lens blades.


N = f / D

N = f stop value
f = focal lenght
D = diameter of the lens opening(effective aperture)

compare:

http://en.wikipedia.org/wiki/F-number

and

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

- - -

In practise this means:

At F stop f/1.4 a lot of light will enter trough the very wide aperture.
You will have a narrow depth of field meaning the background is blurred.
The aperture value in OcaneRender is large.

- - -

At F stop f/22 only a small amount of light will enter trough the now very small opening of the lens.
You will have a wide depth of field meaning the background is sharp.
The aperture value in OctaneRender is small.

- - -

For more information about depth of field compare:

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

- - -
- - -

Some examples:

Example 1:
You are using a lens with a focal lenght of 50mm. The aperture diameter is 25mm.

N = 50 / 25
N = 2


The F-stop value is f/2.

- - -

Example 2:

In order to answer your original question.
With an aperture diameter of 25mm.

4 = focal lenght / 25

focal lenght = 4*25 = 100


Only if you are using a lens with a focal lenght of 100mm an F -stop value of f/4 equals an aperture diameter of 25mm.

Example 3:

Lets asume that you really entered an aperture diameter value of 0.25 mm in OctaneRender.

4 = focal lenght / 0.25

focal lenght = 4*0.25 = 1


Only if you would be using a lens with a focal lenght of 1mm an F - stop value of f/4 would equal an opening diameter of 0.25mm.

While in theory it would be possible to have lenses with 1mm focal lenght in real life the smallest focal lenghts you will be using without any adapters are around 16mm to achieve some wide angle landscape photographs.

- - -
- - -

Compare:

http://en.wikipedia.org/wiki/F-number
http://en.wikipedia.org/wiki/Aperture
http://en.wikipedia.org/wiki/Focal_length

A more practical explanation can be found on:

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


- - -

In any case thank you A LOT for this script. :D

I do not understand why this is called "old school" though. :o ;)

I would call this "photography standard" camera values.

On current photocameras F-stop is the standard value used to indicate the effective opening of the lens created by the blade positions.
Focal lenght is the standard value indicated on any lens you purchase.
Examples: Wide lens 16mm, Portrait lens 85mm, Zoom lens 200mm.

You will in most cases not find any mention of aperture or field of view when working with photo cameras or lenses.

From my point of view aperture and field of view are "very old school".
;)

Re: cam calculator

PostPosted: Wed Jan 28, 2015 4:23 am
by abstrax
linvanchene wrote:...
In any case thank you A LOT for this script. :D

You are welcome. I hope to have f-stop, focal length and film width available in the next release (if time allows).

I do not know why you call this "old school" though. I would call this "photography standard" camera values.

The "old school" was regarding the old exposure settings in the imager node, which again do not control DOF or FOV. Those exposure settings were pretty much arbitrary and while they had the same qualitative behaviour as in a DSLR, they are pretty much useless in Octane since the exposure time is missing and therefor everything is scaled by an arbitrary scale. And since pretty much everybody here (including yourself) can't make the distinction between the imager/tonemapping settings and the camera settings, I pulled them out.

On current photocameras F-stop is the standard value used to indicate the opening of the lens.
Focal lenght is the standard value indicated on any lens you purchase.

You will in most cases not find any mention of aperture or field of view when working with photo cameras or lenses.

From my point of view aperture and field of view are "very old school".[/i] ;)

Yup, that's why we will add f-stop, focal length and film width to the camera node.

Re: cam calculator

PostPosted: Wed Jan 28, 2015 4:33 am
by linvanchene
abstrax wrote:Yup, that's why we will add f-stop, focal length and film width to the camera node.


That is great news indeed. :D

Re: cam calculator

PostPosted: Wed Jan 28, 2015 8:41 am
by bepeg4d
abstrax wrote:Yup, that's why we will add f-stop, focal length and film width to the camera node.

wow, great news, thanks marcus :D
old school guys like me should be very happy :D
ciao beppe

Re: cam calculator

PostPosted: Wed Jan 28, 2015 11:45 pm
by abstrax
During the discussion in viewtopic.php?f=9&t=44522 I realized that the aperture calculation was incorrect, since it calculated the aperture diameter instead of the aperture radius which is what the aperture pin actually specifies. I fixed the script in the opening post.

For fun and out of curiosity I did a little experiment to see how closely the Octane DOF matches a real world photo. So I set up a simple scene with a black pen in front of a white wall and have the wall in focus. I measured the various dimensions and distances and then roughly recreated the scene in Octane via C4D.

This is photo taken with a Canon EOS 550D (sensor size is is 22.3mm x 14.9mm) and a Tamron lens set to a focal length of 50mm and the aperture set to f/2.8 and processed in Lightroom:
IMG_7881_sm.jpg


And this is the approximated scene rendered in Octane:
test_0_8.png


In the image above, I set the "aperture edge" in the camera node to 0.8, but it's hard to get the bokeh into the same ball park, especially since Lightroom also applies some fancy non-linear response and the Tamron is certainly not the lens with the smoothest bokeh on this plant. But yeah, it's pretty close I would say.

This is how it looks like with an aperture edge of 0.5:
test_0_5.png


This is the scene to render the above image:
dof_test.orbx
(111.76 KiB) Downloaded 386 times