POV-Ray : Newsgroups : povray.binaries.images : Calculation of camera angle [ illustration ] Server Time
20 Apr 2024 00:07:25 EDT (-0400)
  Calculation of camera angle [ illustration ] (Message 1 to 9 of 9)  
From: Bald Eagle
Subject: Calculation of camera angle [ illustration ]
Date: 22 Sep 2019 21:25:01
Message: <web.5d881ea3763463c54eec112d0@news.povray.org>
This is a supplement to the image at the top of:

https://www.povray.org/documentation/view/3.6.1/246/

As this is a quick 'n' dirty illustration to answer a question, it's very basic,
and only works properly with an axis-aligned camera location.

Future work would make any combination of camera parameters acceptable, give a
nice, documentation-friendly render, and have much prettier text.    :P


Post a reply to this message


Attachments:
Download 'camera angle equation.png' (124 KB)

Preview of image 'camera angle equation.png'
camera angle equation.png


 

From: Bald Eagle
Subject: Re: Calculation of camera angle [ illustration ]
Date: 23 Sep 2019 20:30:01
Message: <web.5d8962e7873c8c4eec112d0@news.povray.org>
So, based on that, I can cobble together a multiplier for up and right so that
the object never looks any wider than the screen (for any values I've tested).

Do you need the apparent size to remain constant?
Do you need it to be FULL width all the time?

Because that last one is challenging.

https://www.youtube.com/watch?v=mxhxL1LzKww

Do you need it to be less than the image_height as well so that it's "full
screen" and not "full width"?


Post a reply to this message

From: Bald Eagle
Subject: Re: Calculation of camera angle [ illustration ]
Date: 24 Sep 2019 19:55:01
Message: <web.5d8aac66873c8c4eec112d0@news.povray.org>
Can anyone direct me to the source code file where the angle keyword causes a
recalculation of the camera parameters?

That would be a nice read after going through all of this as well.


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Calculation of camera angle [ illustration ]
Date: 1 Oct 2019 14:10:00
Message: <web.5d939576873c8ced4479290@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Can anyone direct me to the source code file where the angle keyword causes a
> recalculation of the camera parameters?
>
> That would be a nice read after going through all of this as well.

Hi Bill

It might be here:
https://github.com/POV-Ray/povray/blob/release/v3.8.0/source/parser/parser.cpp#L1784


BTW: I had a vague memory that one of the vector lengths for the default
perspective camera was changed in v3.8.

So I found this file:
https://github.com/POV-Ray/povray/blob/release/v3.8.0/changes.txt
- with this statement:
"The camera `right` vector length now defaults to the output image aspect ratio
(presuming square pixels) instead of 1.33."

But line no 222 here:
https://github.com/POV-Ray/povray/blob/release/v3.8.0/source/core/scene/camera.cpp#L222
- says "Right       = Vector3d(1.33, 0.0, 0.0); // TODO FIXME"

Perhaps it has been changed somewhere else.

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

From: Bald Eagle
Subject: Re: Calculation of camera angle [ illustration ]
Date: 1 Oct 2019 15:05:01
Message: <web.5d93a22e873c8c4eec112d0@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:

> Hi Bill
>
> It might be here:
> https://github.com/POV-Ray/povray/blob/release/v3.8.0/source/parser/parser.cpp#L1784

Ah, in the parser.   3.8 is pretty hard to follow, but this will be a good
start, and at least something to work with.
The idea is to have a scene file where the camera attributes can be modified to
show the effect using the camera diagram, and output some information to the
debug stream, or the screen to show how the camera vectors atrt off, and then
get modified once the "angle" keyword is invoked.

> BTW: I had a vague memory that one of the vector lengths for the default
> perspective camera was changed in v3.8.
>
> So I found this file:
> https://github.com/POV-Ray/povray/blob/release/v3.8.0/changes.txt
> - with this statement:
> "The camera `right` vector length now defaults to the output image aspect ratio
> (presuming square pixels) instead of 1.33."
>
> But line no 222 here:
>
https://github.com/POV-Ray/povray/blob/release/v3.8.0/source/core/scene/camera.cpp#L222
> - says "Right       = Vector3d(1.33, 0.0, 0.0); // TODO FIXME"
>
> Perhaps it has been changed somewhere else.

I found similar things in my own poking around, and there is
aspectRatio = 4.0 / 3.0;

in source/core/render/tracepixel.cpp   line 243

(looking at hgpovray38, and assuming it's similar enough)





Getting rid of the 1.33 approximation aspectRatio = 4.0 / 3.0;has been talked
about for a LONG time, so I was surprised to see it's still in there.


Post a reply to this message

From: William F Pokorny
Subject: Re: Calculation of camera angle [ illustration ]
Date: 3 Oct 2019 08:17:07
Message: <5d95e6c3$1@news.povray.org>
On 10/1/19 2:08 PM, Tor Olav Kristensen wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>> Can anyone direct me to the source code file where the angle keyword causes a
>> recalculation of the camera parameters?
>>
>> That would be a nice read after going through all of this as well.
> 
> Hi Bill
> 
> It might be here:
> https://github.com/POV-Ray/povray/blob/release/v3.8.0/source/parser/parser.cpp#L1784
> 
> 
> BTW: I had a vague memory that one of the vector lengths for the default
> perspective camera was changed in v3.8.
> 
> So I found this file:
> https://github.com/POV-Ray/povray/blob/release/v3.8.0/changes.txt
> - with this statement:
> "The camera `right` vector length now defaults to the output image aspect ratio
> (presuming square pixels) instead of 1.33."
> 
> But line no 222 here:
>
https://github.com/POV-Ray/povray/blob/release/v3.8.0/source/core/scene/camera.cpp#L222
> - says "Right       = Vector3d(1.33, 0.0, 0.0); // TODO FIXME"
> 
> Perhaps it has been changed somewhere else.
> 
> --
> Tor Olav
> http://subcube.com
> https://github.com/t-o-k
> 
> 
Hi, You remember correctly, but it was done based upon the #version 
statement along with a change to the default ambient value v37 did not 
originally get on the v36 to v37 assumed_gamma default update. The 
latter a reason why v36 and older scenes appear washed out to some 
degree in v37.

See the closed issue (end of 2017):

  https://github.com/POV-Ray/povray/issues/304

and the cooresponding commit:

https://github.com/POV-Ray/povray/commit/12fbab3e

and sepcifically the added method/function Parser::InitDefaults.

The comment in camera.cpp should have been updated at that time to note 
the parser's InitDefaults would set/override the value, but it was 
missed I guess. Suppose we should open an issue to do this though a lot 
of work for a comment change... Unfortunate Christoph not about as he'd 
usually roll up something like this with other changes.

Lastly, thanks for the camera.cpp#L222 line number reference trick in 
the link! New to me and useful.

Bill P.


Post a reply to this message

From: POVeddie
Subject: Re: Calculation of camera angle [ illustration ]
Date: 13 Oct 2019 17:05:01
Message: <web.5da39040873c8c4e86ba8f0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> So, based on that, I can cobble together a multiplier for up and right so that
> the object never looks any wider than the screen (for any values I've tested).

Did you intend to show the default up vector in your image? If so, then it
should be <0,1,0>


Post a reply to this message

From: Bald Eagle
Subject: Re: Calculation of camera angle [ illustration ]
Date: 13 Oct 2019 19:00:01
Message: <web.5da3abbb873c8c4eec112d0@news.povray.org>
"POVeddie" <nomail@nomail> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > So, based on that, I can cobble together a multiplier for up and right so that
> > the object never looks any wider than the screen (for any values I've tested).
>
> Did you intend to show the default up vector in your image? If so, then it
> should be <0,1,0>

Indeed.
I think I got myself mentally caught halfway between the actual vectors being
shown, esp given the diagram at:

http://www.povray.org/documentation/view/3.7.0/246/

and plugging calculated values into vstr().

I suppose I ought to redo that to move the up and right to z=0 where they
_should_ be shown.

Thanks for catching that - I was more focused on getting the camera angle
calculations to work out consistently.   :)


Post a reply to this message

From: POVeddie
Subject: Re: Calculation of camera angle [ illustration ]
Date: 14 Oct 2019 15:45:01
Message: <web.5da4cfac873c8c4e86ba8f0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Thanks for catching that - I was more focused on getting the camera angle
> calculations to work out consistently.   :)

You're welcome.
Your work on the camera angle is great.
I was just calling out the up vector for accuracy. ;)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.