cam calculator [fixed]

Forums: cam calculator [fixed]
Forum for OctaneRender Lua scripting examples, discussion and support.

cam calculator [fixed]

Postby abstrax » Sat Dec 13, 2014 10:39 pm

abstrax Sat Dec 13, 2014 10:39 pm
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 758 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
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
abstrax
OctaneRender Team
OctaneRender Team
 
Posts: 5483
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

Re: cam calculator

Postby Tugpsx » Sun Dec 14, 2014 12:43 am

Tugpsx Sun Dec 14, 2014 12:43 am
Very nice, thanks for adding this it will come in handy.
Dell Win Vista 32 | NVIDIA Quadro NVS135M | Core2 Duo T7500 2.20GHz | 4GB
CyberPowerPC Win 7 64| NVIDIA GTX660Ti (3G) GTX480(1.5G) | 16GB
Tugpsx
Licensed Customer
Licensed Customer
 
Posts: 1145
Joined: Thu Feb 04, 2010 8:04 pm
Location: Chicago, IL

Re: cam calculator

Postby p3taoctane » Sun Dec 14, 2014 3:03 am

p3taoctane Sun Dec 14, 2014 3:03 am
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
Windows 7 Pro_SP 1_64 bit_48 GB Ram_Intel Xeon X5660 2.80 GHZ x2_6 580GTX_1 Quadra 4800
p3taoctane
Licensed Customer
Licensed Customer
 
Posts: 1418
Joined: Mon Jan 25, 2010 12:53 am

Re: cam calculator

Postby glimpse » Tue Jan 27, 2015 11:29 am

glimpse Tue Jan 27, 2015 11:29 am
wow, Thanks Guys! =)
This will come handy!
User avatar
glimpse
Licensed Customer
Licensed Customer
 
Posts: 3715
Joined: Wed Jan 26, 2011 2:17 pm

Re: cam calculator

Postby glimpse » Tue Jan 27, 2015 2:47 pm

glimpse Tue Jan 27, 2015 2:47 pm
"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?
User avatar
glimpse
Licensed Customer
Licensed Customer
 
Posts: 3715
Joined: Wed Jan 26, 2011 2:17 pm

Re: cam calculator

Postby linvanchene » Wed Jan 28, 2015 4:05 am

linvanchene Wed Jan 28, 2015 4:05 am
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".
;)
Last edited by linvanchene on Thu Jan 29, 2015 3:06 am, edited 7 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
linvanchene
Licensed Customer
Licensed Customer
 
Posts: 783
Joined: Mon Mar 25, 2013 10:58 pm
Location: Switzerland

Re: cam calculator

Postby abstrax » Wed Jan 28, 2015 4:23 am

abstrax Wed Jan 28, 2015 4:23 am
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.
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
abstrax
OctaneRender Team
OctaneRender Team
 
Posts: 5483
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

Re: cam calculator

Postby linvanchene » Wed Jan 28, 2015 4:33 am

linvanchene Wed Jan 28, 2015 4:33 am
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
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
linvanchene
Licensed Customer
Licensed Customer
 
Posts: 783
Joined: Mon Mar 25, 2013 10:58 pm
Location: Switzerland

Re: cam calculator

Postby bepeg4d » Wed Jan 28, 2015 8:41 am

bepeg4d Wed Jan 28, 2015 8:41 am
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
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 9940
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy

Re: cam calculator

Postby abstrax » Wed Jan 28, 2015 11:45 pm

abstrax Wed Jan 28, 2015 11:45 pm
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 378 times
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
abstrax
OctaneRender Team
OctaneRender Team
 
Posts: 5483
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand
Next

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 6 guests

Fri Mar 29, 2024 12:42 pm [ UTC ]