Field of View and distortions at extreme aspect ratios

Discuss anything you like on this forum.
Post Reply
User avatar
linvanchene
Licensed Customer
Posts: 783
Joined: Mon Mar 25, 2013 10:58 pm
Location: Switzerland

I post this here in hope to get some feedback of users or OctaneRender staff.
Which of those things I put together are true?
Did I somewhere assume something that just does not work that way?


I experimented with different render engines and images at extreme aspect ratios.


What I was able to observe was:

When Field of View is measured across the narrower of the two sides of an image distortions are visible when rendering images at extreme aspect ratios.

Theoretical examples:
When rendering an image
- with a horizontal aspect ratio of 10x1 (x:y)
distortions are visible when a vertical field of view is used.

- with a vertical aspect ratio of 1x10 (x:y)
distortions are visible when a horizontal field of view is used.

Practical examples:

OctaneRender standalone seems to use a horizontal field of view.
When rendering images at extreme horizontal aspect ratios of 1x10 no distortions are visible.
Nevertheless when rendering images at extreme vertical aspect ratios of 10x1 distortions are visible.

DAZ Studio 3Delight seems to use a vertical field of view.
When rendering images at extreme horizontal aspect ratios of 10x1 distortions are visible
Nevertheless when rendering images at extreme vertical aspect ratios of 1x10 no distortions are visible.

- - -

Possible solution: :?:

When Field of View is measured across the wider of the two sides of an image
almost no distortions are visible when rendering images at extreme aspect ratios.


When rendering images with horizontal aspect ratios
- a horizontal Field of View is used.

When rendering images with vertical aspect ratios
- a vertical Field of View is used.
Field of View and resulting distortions v1002.jpg
Visual help:
red bar means there are distortions
green bar means there are no distortions

- - -

Could this in theory work?
I am not suggesting that now OctaneRender adopts that system.
I guess for many reasons it is easier to work with just horizontal Field of View always.

But I am still interested if in theory if we want to render images with the least amount of distortion we should always measure field of view across the wider of the two sides of the image?

Do you know any 3D software or render engines that are allready doing it that way?

Or did I asume quite a lot of things and this may not work that way? :?:

- - -

Update / Edit:
For the test images I used
- a focal lenght of 35mm in the OcDS plugin
- a horizontal field of view of 54.4 in OctaneRender standalone
You do not have the required permissions to view the files attached to this post.
Last edited by linvanchene on Mon Aug 25, 2014 9:55 pm, edited 1 time 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
roeland
OctaneRender Team
Posts: 1823
Joined: Wed Mar 09, 2011 10:09 pm

The distortions you see are an artefact of using a perspective camera with an very wide field of view. For reference, photographers consider an 18mm lens on a 35mm film camera a very wide angle lens. The resulting field of view for this combination is 90°×67°.

Suppose you're rendering with a 1:5 aspect ratio (portrait orientation).

You could pick a field of view of 45° along the horizontal axis, which corresponds to a field of view axis of 128° along the vertical axis. A field of view this wide will result in a lot of distortion in the top and bottom of the image. This shows a disadvantage to using the horizontal field of view angle as in octane: with aspect ratios like this the vertical field of view can be surprisingly wide for a setting which otherwise looks normal.

Or you can pick a field of view of 45° along the vertical axis, which corresponds to a field of view axis or as 9.5° along the horizontal axis. This image won't have much distortion. But this lack of distortion is just because you picked a more narrow field of view, not because you use a different way to choose this field of view.

The goal for users is to pick a field of view which gives a pleasing image composition, or for interiors they may need to pick a field of view which shows almost the entire room. If we change the system they just need to enter a different number to get the same field of view, with the same distortion.

--
Roeland
User avatar
linvanchene
Licensed Customer
Posts: 783
Joined: Mon Mar 25, 2013 10:58 pm
Location: Switzerland

What is the goal of this post?
- I plan to put together a Journal entry on deviantart that gives a summary how computer graphics software simulate cameras.

- I believe that many people are in the same position as I am and make a lot of assumptions how things work in computer graphics based on their knowledge off photography

- I know it is a lot to read trough but if you can provide any insight into those points I am still confused about that would help tremendously.

- Please correct me if you notice that I am asuming things that are not true.

- - -

The shorter version:


Roeland, thank you so much for taking the time to answer.
The short answer is that now it seems clear how it works the way it does.
But I am still a bit puzzled about the WHY:

Why are the aspect ratios entered in the formula for angle of view?

α = 2 arctan d/2f

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

In photography the reference system is a 35mm film camera with 2x3 aspect ratio sensor with 36mm width and 24mm height.

We use

d = 36 mm for horizontal FoV
d = 24 mm for vertical FoV

The lenght of the side (unit mm) we want to measure is put in relationship to the focal lenght (unit mm).

Source:
http://en.wikipedia.org/wiki/Crop_factor

- - -

But in Computer Graphic Camera Systems this very formula seems to be used different:

α = 2 arctan d/2f

Example:
A computer graphics camera with aspect ratio 1x5
d = 1 for horizontal FoV
d = 5 for vertical FoV

On a more practical note:
If you have an aspect ratio of 3x2
are you using d = 3 and d = 2 or are you using d = 1.5 and d = 1?

The Focal lenght f is still measured in mm but what is the unit of the aspect ratios?

After everything I figured out so far I still do not understand why different units are mixed together when we use a value for one side of the aspect ratio d and put that in relationship to the focal lenght in mm.

What I always asumed when someone was posting the formula is that we would keep using the standard 35mm 3x2 aspect ratio and would keep entering 36mm and 24mm for d.
I asumed that the aspect ratio of the viewport would only be used to crop inside a simulated image field of the sensor.
But as it turned out this is not the case:

The distortions you see are an artefact of using a perspective camera with an very wide field of view.
This leads me to the question:

Based on which asumption are we using this adjusted formula for angle of view in computer graphics?


Update / Edit:

On a more practical note:
If you have an aspect ratio of 3x2
are you using d = 3 and d = 2 or are you using d = 1.5 and d = 1? :?:


- - -

The very long version

I write the following as feedback so you may get an impression where users have difficulties in understanding how the whole camera system in OctaneRender works with field of view.
I also would like to provide other users with all the information they would probably need to follow this topic.


I have a background in video and photography and am used to working with different lenses and different image sensors like 35mm full frame and APS-C.

Therefore I am mostly used to working with focal lenght. Field of view was a parameter that I had heared of but was never directly relevant.
For reference, photographers consider an 18mm lens on a 35mm film camera a very wide angle lens. The resulting field of view for this combination is 90°×67°.

So far I was able to follow the example and got the same results when using the formula.

α = 2 arctan d/2f

The reference system is a 35mm film camera with 2x3 aspect ratio sensor with 36mm width and 24mm height.

We use

d = 36 mm for horizontal FoV
d = 24 mm for vertical FoV

or

I could just have used the Angular Field of View Calculator

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

Focal lenght multiplier: 1 (because it is a 35mm standard lens)
Width / Height Image Ratio: 3x2


- - -
So far so good.
But now it got tricky very quickly.
In order to keep following the example I had to read up on:

Angle of view:
http://en.wikipedia.org/wiki/Angle_of_view

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

Inverse Functions:

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

and

http://en.wikipedia.org/wiki/Inverse_tr ... _functions

Suppose you're rendering with a 1:5 aspect ratio (portrait orientation).
You could pick a field of view of 45° along the horizontal axis, which corresponds to a field of view axis of 128° along the vertical axis. A field of view this wide will result in a lot of distortion in the top and bottom of the image. This shows a disadvantage to using the horizontal field of view angle as in octane: with aspect ratios like this the vertical field of view can be surprisingly wide for a setting which otherwise looks normal.
This section completly puzzled me.
At first I just could not figure out how the value of 128° along the vertical axis was calculated.
Based on the formula I got α = 30.87°.

I still asumed that the field of view would be calculated based on a 35mm sensor as in photography.
α = 2 arctan d/2f

Example:
35mm film camera with 2x3 aspect ratio sensor with 36mm width and 24mm height.
d = 36 mm for horizontal FoV
d = 24 mm for vertical FoV
The Horizontal Field of View is 45°.

Goal: Find out the Vertical Field of View based on a known Horizontal Field of View.
Step 1: We are first calculating the Focal Length f.
f= ?
Because of the horizontal FoV we take d = 36 and α = 45.

45 = 2 arctan 36/2f
45 /2 = arctan 36 / 2f
Because y = arctan x is per definition x = tan y we get

36 / 2f = tan 45 /2
f = 18 / tan 22.5
f = 43.46 mm

Step 2: Now we can calculate the Vertical Field of View

Focal Length f= 43.46
Because of the Vertical Field of View we take d = 24mm
α = 2 arctan 24 / (2 * 43.46)
α = 30.87
I also double checked with the Angular Field of View Calculator.

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

Then suddenly I got the idea that maybe for some weird reason the aspect ratio of 1x5 was used in the formula in computer graphics to calculate field of view.
α = 2 arctan d/2f

Example 3:
A computer graphics camera with aspect ratio 1x5
d = 1 for horizontal FoV
d = 5 for vertical FoV
The Horizontal Field of View is 45°.

Goal: Find out the Vertical Field of View based on a known Horizontal Field of View.
Step 1: We are first calculating the Focal Length f.
f= ?
Because of the horizontal FoV we take d = 1 and α = 45.

45 = 2 arctan 1/2f
45 /2 = arctan 1 / 2f
Because y = arctan x is per definition x = tan y we get

1 / 2f = tan 45 /2
f = 1 / (2* tan 22.5)
f = 1.21

Step 2: Now we can calculate the Vertical Field of View
Focal Length f= 1.21
Because of the Vertical Field of View we take d = 5
α = 2 arctan 5 / (2 * 1.21)
α = 128.45
Now that I understood how to do the math it was more quick to get to the same result as in the next example as well:
Or you can pick a field of view of 45° along the vertical axis, which corresponds to a field of view axis or as 9.5° along the horizontal axis. This image won't have much distortion. But this lack of distortion is just because you picked a more narrow field of view, not because you use a different way to choose this field of view.
Are there simpler ways to calculate Field of View?

Is there a simpler way to calculate horizontal field of view if you allready know vertical field of view?

Is there a simpler way to calculate vertical field of view if you allready know horizontal field of view?

Unfortunately for those cases I was not able to use the Angular Field of View Calculator.

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

There are only templates for default sensor aspect ratios like 3x2 and 4x3.

In addtion that calculator only works in one direction. If you know focal lenght you can get field of view but not the other way around.

Does anyone know of an online source that offers the options to

- enter different aspect ratios
- calculate Focal lenght based on Field of View
- calculate horizontal Field of View based on Vertical Field of View
- calculate vertical Field of View based on Horizontal Field of View

:?:

I guess here the questions related to this topic end.
Thank you very much if you read so far allready!

- - -
- - -

I now add some off topic ideas that came to mind while trying to figure out how Field of View and Cameras work in OctaneRender. Maybe they are of some use to developers who are looking for user feedback. But this section will not add any more understanding how OctaneRender cameras work.


Offtopic:

Feature Suggestions for OctaneRender cameras


Without changing the existing camera presets
- Thin Lense Camera
- Panoramic Camera

add

- a camera preset that works exactly like the Thin Lense Camera but uses Vertical Field of View
- a camera preset that simulates Focal Lenght and the corresponding depth of field.


-
The goal for users is to pick a field of view which gives a pleasing image composition, or for interiors they may need to pick a field of view which shows almost the entire room.
I understand that for most users it will certainly be enough to adjust a field of view slider and trust the eye that the field of view they see is what they creatively need.

Still for me it was important to actually be able to understand why an image in onc computer graphics software looks so completly different than an image in another computer graphics software.

In addition I plan to use a lot of different OctaneRender Render plugins in the future and am interested in trying to composite images that match across many different software.

Because of that it is very important for me to understand the differences of the camera system in various software.
If we change the system they just need to enter a different number to get the same field of view, with the same distortion.
As far as I understand OctaneRender standalone works the way it does maybe exactly so a lot of different plugins can send their data to the standalone and later on to the CloudRender edition.

Therefore it is important to use a system that is compatible with a lot of different software.

Still some things come to mind.

In general I find it very important not to change existing systems.
Instead it seems more useful to add features that work independent of the existing system.


There will always be users who prefer to keep things as they are and backwards compatibility is necessary for longer projects.

For some users it could be helpful to add additional camera presets to the existing ones.

Currently we have

- Thin Lense Camera
- Panoramic Camera

Why not add a camera that calculates field of view based on a vertical aspect ratio?

Those advanced users that know what benefit that has when rendering vertical web banners might find it useful.

In addtion one could argue that traditionaly monitors with horizontal aspect ratios were more commonly used in the past. But with the arrival of internet browsing on mobile phones and tablets the vertical aspect ratio has once again become more frequent.

Why not add a camera preset that gives the user the possibility to work with focal length?

Because many different software send data to the standalone it may be very important that camera values are not linked by default. It is also a very creative way to work if you can create your own depth of field that may not be possible in real life.

Especially for new users who do not understand how depth of field and field of view are connected it might be simpler to work with focal lenght.

Users can adjust focal lenght with a slider and depht of field is automatically calculated based on
- a specific lens
- a specific sensor size

- Existing values like aperture and field of fiew are automatically updated when the users moves the focal lenght slider.

- There could also be an option to unlink focal lenght similar like it is possible to toggle on and off autofocus.

- - -

If you read so far thank you for all your patience and your help!
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
riggles
Licensed Customer
Posts: 493
Joined: Mon Feb 17, 2014 3:34 pm
Location: CT, USA

Sorry, that was kind if a bit too long to read through. But to try and offer an answer, the reason there's no focal length settings is because there's no film/camera back system. I wish there was, because not having it renders most of our photographic experience useless, unless you use the plugin versions.

Yes, Octane is fixed only on the horizontal field of view. Since there is no film back system in Octane standalone, only worry about the aspect ratio of your output resolution. So if your camera has a 45deg FOV (horizontally) and you want to render a portrait image with a 3:2 aspect ratio, just multiply 45 x 1.5 = 67.5 and that's your new FOV to use.
User avatar
linvanchene
Licensed Customer
Posts: 783
Joined: Mon Mar 25, 2013 10:58 pm
Location: Switzerland

Sorry, that was kind if a bit too long to read through.
I devided the original post in three sections:
The shorter version
The very long version
And some offtopic feature suggestions.

If you just want the summary you can read trough the shorter version and ignore the rest.

- - -

Yes, I am aware that the whole post will be too long for 99% of the people.
I posted this thread in the offtopic forum exactly because there may only be very few people who are interested in figuring out the math behind everything.

Still I found on other forums the main reasons why there are so many missunderstandings about 3D camera systems is because most users do not care enough to actually try and understanding the math behind it.

Most people just post a forumla but never actually try to calculate an example.
Only when you try to to calculate it you start to notice how many different parts of the angle of view formula are completly up for interpretations.

So many different 3D software achieve different camera results. They all interpret the same formula based on different assumptions or simplifications of reality.

But to try and offer an answer, the reason there's no focal length settings is because there's no film/camera back system. I wish there was, because not having it renders most of our photographic experience useless, unless you use the plugin versions.
+1
So if your camera has a 45deg FOV (horizontally) and you want to render a portrait image with a 3:2 aspect ratio, just multiply 45 x 1.5 = 67.5 and that's your new FOV to use.
I am now looking at this calculation and I have once again no clue on which assumption this simplified calculation is based.

The very reason why I made my post that extremely long was to provide users that are interested in understanding the math with all the tools they need so they can follow each step.

In the example above I calculated that on a standard 35mm full frame sensor camera a horizontal field of view of 45° is achieved by a focal lenght of f = 43.46mm.

The angle of view formula I posted in this thread gives different answers depending on which assumptions you use:

This very example of a 3x2 aspect ratio lead me to the question which value I should take for d when calculating horizontal field of view. :?:

Do we look at it as

3:2
or
1.5:1

In one case for the horizontal FOV we take d = 3 in the other case we take d = 1.5

IF we take d = 1.5 then

Focal Length f= 43.46
α = 2 arctan 1.5 / (2 * 43.46)
α = 1.98
IF we take d = 3 then

Focal Length f= 43.46
α = 2 arctan 3 / (2 * 43.46)
α = 3.95
So we have now 3 possible different results for α based on three different assumptions how the horizontal field of view of the viewport is calculated.

α = 67.5
α = 1.98
α = 3.95

This is why I am so puzzled about why in calculating computer graphic cameras we put the unit focal lenght measured in mm in relation to the aspect ratio. :roll:

Or to put it different:

For that reason some computer graphics software treat the viewport as simulated image sensor.
The sides of the viewport are then messured in the unit mm that can be put into relation to the focal lenght also in unit mm.
:!:

I leave it at that. Maybe some months later someone will ask the same questions and by accident stumble on this thread.
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
riggles
Licensed Customer
Posts: 493
Joined: Mon Feb 17, 2014 3:34 pm
Location: CT, USA

The formula to calculate horizontal FOV is: a = 2 atan (0.5 width / focal length) - http://paulbourke.net/miscellaneous/lens/

So, if you're used to referencing 35mm lens systems, which has a film back size of (H) 24mm x (W) 36mm, and you want to find a 50mm lens FOV, the equation would be: a = 2 atan (18 / 50) = 2 atan (0.36) = 39.5978°

Since Octane uses the horizontal field of view, it's going to fill up the width of the render window to match, and what you see vertically varies. With extreme aspect ratio outputs, it's either going to look like the top and bottom of the image is cropped off (horizontal) or it's stretched to a really wide-angle lens (vertical). Again, this is because Octane locks the horizontal FOV to the left and right edges of the frame.

If you want to create a portrait image, you need to change the FOV. You can do it two ways: based on film back size or based on output resolution aspect ratio like I mentioned above. If you choose output resolution, divide the existing FOV by the output aspect ratio. If the output aspect ratio is 3:2 (which is 1.5), your formula would be 39.5978 / 1.5 = 26.3985°.

Or you can think of it like rotating your SLR 90° when taking pictures. The film back width is effectively 24mm for those shots. So you can recalculate horizontal FOV using that dimension as the width: 2 atan (12 / 50) = 26.9914°

I hope that explains it a bit more.

Edit: I realize now that my previous post said to multiply 45° by the aspect ratio. That was a mistake, as I was still thinking in focal length terms. Sorry for confusing things there.
User avatar
linvanchene
Licensed Customer
Posts: 783
Joined: Mon Mar 25, 2013 10:58 pm
Location: Switzerland

riggles, thank you so much for taking the time to post a follow up.

What you wrote indeed helped me to fill some missing gasp that I overlooked.

The formula to calculate horizontal FOV is: a = 2 atan (0.5 width / focal length) - http://paulbourke.net/miscellaneous/lens/

So, if you're used to referencing 35mm lens systems, which has a film back size of (H) 24mm x (W) 36mm, and you want to find a 50mm lens FOV, the equation would be: a = 2 atan (18 / 50) = 2 atan (0.36) = 39.5978°
So far so good.

That is the same formula I also used. The one on the wiki page just writes it a bit different.

α = 2 arctan d/2f

Source: http://en.wikipedia.org/wiki/Angle_of_view
Since Octane uses the horizontal field of view, it's going to fill up the width of the render window to match, and what you see vertically varies. With extreme aspect ratio outputs, it's either going to look like the top and bottom of the image is cropped off (horizontal) or it's stretched to a really wide-angle lens (vertical). Again, this is because Octane locks the horizontal FOV to the left and right edges of the frame.
:!:

Thank you a lot. This was a missing piece of information to make sense of what I see in the viewport when I adjust the resolution.

It indeed seems that all objects that are placed in the OctaneRender standalone that are aligned to match the left and right edge of the viewport will stay in that very position when we change the image resolution and the aspect ratios.

Some test images make that property more visible in OctaneRender standalone:
Horizontal Distance between left and right viewport edge is locked 100x1000.jpg
Horizontal Distance between left and right viewport edge is locked 1000x1000.jpg
If you want to create a portrait image, you need to change the FOV. You can do it two ways: based on film back size or based on output resolution aspect ratio like I mentioned above. If you choose output resolution, divide the existing FOV by the output aspect ratio. If the output aspect ratio is 3:2 (which is 1.5), your formula would be 39.5978 / 1.5 = 26.3985°.
Now that it is clear that the horizontal distance between the left and the right viewport corners is constant this makes indeed sense.
Or you can think of it like rotating your SLR 90° when taking pictures. The film back width is effectively 24mm for those shots. So you can recalculate horizontal FOV using that dimension as the width: 2 atan (12 / 50) = 26.9914°

I hope that explains it a bit more.
Yes, the additional information you posted now made everything that you posted very clear.
Edit: I realize now that my previous post said to multiply 45° by the aspect ratio. That was a mistake, as I was still thinking in focal length terms. Sorry for confusing things there.
Your post only added to my existing confusion. Everything you now wrote made complete sense.

What still does not make sense to me is the original example that was written before you posted:

Suppose you're rendering with a 1:5 aspect ratio (portrait orientation).

You could pick a field of view of 45° along the horizontal axis, which corresponds to a field of view axis of 128° along the vertical axis. A field of view this wide will result in a lot of distortion in the top and bottom of the image. This shows a disadvantage to using the horizontal field of view angle as in octane: with aspect ratios like this the vertical field of view can be surprisingly wide for a setting which otherwise looks normal.

Or you can pick a field of view of 45° along the vertical axis, which corresponds to a field of view axis or as 9.5° along the horizontal axis. This image won't have much distortion. But this lack of distortion is just because you picked a more narrow field of view, not because you use a different way to choose this field of view.
In order to get those values it seems the aspect ratio is used in the formulas we posted.
d = 1 for horizontal FoV
d = 5 for vertical FoV
The Horizontal Field of View is 45°.
Goal: Find out the Vertical Field of View based on a known Horizontal Field of View.
Step 1: We are first calculating the Focal Length f.
f= ?
Because of the horizontal FoV we take d = 1 and α = 45.
45 = 2 arctan 1/2f
45 /2 = arctan 1 / 2f
Because y = arctan x is per definition x = tan y we get

1 / 2f = tan 45 /2
f = 1 / (2* tan 22.5)
f = 1.21

Step 2: Now we can calculate the Vertical Field of View
Focal Length f= 1.21
Because of the Vertical Field of View we take d = 5
α = 2 arctan 5 / (2 * 1.21)
α = 128.45
This is why I am so puzzled about why in calculating computer graphic cameras we put the unit focal lenght measured in mm in relation to the aspect ratio
You do not have the required permissions to view the files attached to this post.
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
Post Reply

Return to “Off Topic Forum”