POV-Ray : Newsgroups : povray.general : Positioning a camera Server Time
2 Aug 2024 00:18:37 EDT (-0400)
  Positioning a camera (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: Christoph Hormann
Subject: Re: Positioning a camera
Date: 17 Apr 2005 08:05:02
Message: <d3tj4b$bej$1@chho.imagico.de>
Cesar wrote:
> 
> I honestly don't think it's a bug in my app. The vectors are, for example:
> 
> direction <0,  1, 0>
> up <0.198669, 0, 0.980067>
> right <1.30349, 0, -0.26423>
> 
> and povray complains about perpendicularity.

And does so rightly,

0.198669*1.30349 + 0.980067*(-0.26423) = 4.86e-8 != 0.0

Specifying the up and right vector the way you did it usually does not 
make sense.  You usually orient the camera with look_at or rotations and 
leave up and right as default (except aspect ratio).  See the docs, 
"3.3.1.1.5 Up and Right Vectors" for more explanation.

And no, using doubles in your program won't help since you transfer the 
numbers in decimal ascii.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 27 Feb. 2005 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Cesar
Subject: Re: Positioning a camera
Date: 17 Apr 2005 09:40:00
Message: <web.4262667f1c98b29b6ef2a7230@news.povray.org>
> And does so rightly,
>
> 0.198669*1.30349 + 0.980067*(-0.26423) = 4.86e-8 != 0.0
>
> Specifying the up and right vector the way you did it usually does not
> make sense.  You usually orient the camera with look_at or rotations and
> leave up and right as default (except aspect ratio).  See the docs,
> "3.3.1.1.5 Up and Right Vectors" for more explanation.
>
> And no, using doubles in your program won't help since you transfer the
> numbers in decimal ascii.
>
> Christoph
>
> --
> POV-Ray tutorials, include files, Sim-POV,
> HCR-Edit and more: http://www.tu-bs.de/~y0013390/
> Last updated 27 Feb. 2005 _____.//^>_*_<^/.______

Ok... Could I use look-at and use my recently calculated up-vector as sky?
Would that work? Or I have to use "angle" to make it right? Problems aside,
this subject brings me to another question: is there a way to make povray
accept the non-perpendicular vectors and generate a distorted image? I
could be interested in that...


Post a reply to this message

From: Alain
Subject: Re: Positioning a camera
Date: 17 Apr 2005 11:06:53
Message: <42627b8d@news.povray.org>
Cesar nous apporta ses lumieres en ce 2005-04-17 09:37:
>>And does so rightly,
>>
>>0.198669*1.30349 + 0.980067*(-0.26423) = 4.86e-8 != 0.0
>>
>>Specifying the up and right vector the way you did it usually does not
>>make sense.  You usually orient the camera with look_at or rotations and
>>leave up and right as default (except aspect ratio).  See the docs,
>>"3.3.1.1.5 Up and Right Vectors" for more explanation.
>>
>>And no, using doubles in your program won't help since you transfer the
>>numbers in decimal ascii.
>>
>>Christoph
>>
>>--
>>POV-Ray tutorials, include files, Sim-POV,
>>HCR-Edit and more: http://www.tu-bs.de/~y0013390/
>>Last updated 27 Feb. 2005 _____.//^>_*_<^/.______
> 
> 
> Ok... Could I use look-at and use my recently calculated up-vector as sky?
> Would that work? Or I have to use "angle" to make it right? Problems aside,
> this subject brings me to another question: is there a way to make povray
> accept the non-perpendicular vectors and generate a distorted image? I
> could be interested in that...
> 
> 
When POV Ray complains about non perpendicular, it's just a warning. It will still
render the scene. 
Yes, it can lead to skewed or distorted image. It's similar to those cameras where you
can shift and 
rotate the objective relative to the film plane. (at least in my view)

Alain


Post a reply to this message

From: Rune
Subject: Re: Positioning a camera
Date: 18 Apr 2005 05:08:25
Message: <42637909$1@news.povray.org>
Cesar wrote:
> Ok... Could I use look-at and use my recently calculated up-vector as
> sky? Would that work?

That should work, yes.

(with look_at = location + [your calculated direction])

I don't agree with Christoph though that your original approach doesn't make 
sense. You just need to really make sure the vectors are perpendicular.

Untested code:

#include "math.inc"
#declare cam_direction = <0,  1, 0>;
#declare cam_up = <0.198669, 0, 0.980067>;
#declare cam_right = <1.30349, 0, -0.26423>;

camera {
  direction cam_direction
  up VPerp_Adjust(cam_up,cam_direction)*vlength(cam_up)
  right vcross(cam_up,cam_direction)*vlength(cam_right)
}

> Problems aside, this subject brings me to another question: is there
> a way to make povray accept the non-perpendicular vectors and
> generate a distorted image? I could be interested in that...

Yes, if you turn off the vista buffer by using the -uv command line setting.

Rune
-- 
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

From: Warp
Subject: Re: Positioning a camera
Date: 18 Apr 2005 05:27:11
Message: <42637d6f@news.povray.org>
Cesar <ces### [at] terracombr> wrote:
> I used to set location and look-at, but now I need different movements, so I
> decided to calculate location, direction, up and right. Then I started
> having problems. I allways get the error that says the vectors are not
> perpendicular.

  Let me guess: You are not printing enough decimals.

  By default C and C++ print only a few decimals for floating point numbers
(six, if I remember correctly). This rounds (from POV-Ray's point of view)
the values way too much. You have to print the values more accurately,
with like 15 decimals or so to be sure.
  The way to increase printing accuracy of floating point numbers depends
on whether you are printing using C or C++ streams.

-- 
                                                          - Warp


Post a reply to this message

From: Cesar
Subject: Re: Positioning a camera
Date: 18 Apr 2005 14:15:01
Message: <web.4263f7dc1c98b29bb45fb2880@news.povray.org>
>   Let me guess: You are not printing enough decimals.
>
>   By default C and C++ print only a few decimals for floating point numbers
> (six, if I remember correctly). This rounds (from POV-Ray's point of view)
> the values way too much. You have to print the values more accurately,
> with like 15 decimals or so to be sure.
>   The way to increase printing accuracy of floating point numbers depends
> on whether you are printing using C or C++ streams.
>
> --
>                                                           - Warp


Thanks for the answers! I'm using povray to simulate a camera we have in an
airship, so I'm interested in the distorted image cause then I can directly
simulate a not perfect camera, instead of introducing the erros in the
already rendered image.

I've been programming in c/c++ for years but I just realized I never had to
change printing accuracy of floating point numbers in c++, only in c.
Anyway, i found the precision() function (member of the ostream class) and
set the precision to 15 digits. Even so, povray still complains. I checked
the angles inside povray and I got things like: 90.0000001 and 89.9999993.
I think I'll work with this values and accept a most probably not
noticeable distortion (if I adjust the vectors inside povray, they will be
inconsistent with the c++ app).

Thanks again,

Cesar


Post a reply to this message

From: Sascha Ledinsky
Subject: Re: Positioning a camera
Date: 18 Apr 2005 14:44:21
Message: <42640005$1@news.povray.org>
> And no, using doubles in your program won't help since you transfer the 
> numbers in decimal ascii.

Well, in my case it did help. I had a very similar problem (my program 
set up a transformation matrix for the camera), and by swiching to 
doubles I got rid of the "Camera vectors are not perpendicular" message.

Is there any other format than decimal ascii that POV would accept?

 > And does so rightly,
 > 0.198669*1.30349 + 0.980067*(-0.26423) = 4.86e-8 != 0.0

I don't know if the vista buffer would still work if POV would accept 
vectors that are perpendicular within single precision limits. If yes, 
the test should IMHO be changed to be less pedantic.

 > You usually orient the camera with look_at or rotations and leave up
 > and right as default (except aspect ratio)

That's true for scenes that were created "by hand" with POV-SDL. When 
using external applications e.g. to animate the camera, I usually don't 
orient it with look_at...

-sascha


Post a reply to this message

From: Cesar
Subject: Re: Positioning a camera
Date: 19 Apr 2005 10:10:01
Message: <web.426510bb1c98b29babdc606d0@news.povray.org>
Yeah... I changed everything to double precision and now I don't get the
warning anymore (andit was expected, using ascii to represent the number
has nothing to do with precision). But I think I might still get some
errors in very specific situations (if I make too many calculations, small
errors might sum up).

Ah! Is there a similar way to specify object position? without specifying a
rotation (and using directing vectors instead)?


Post a reply to this message

From: Sascha Ledinsky
Subject: Re: Positioning a camera
Date: 19 Apr 2005 11:01:42
Message: <42651d56$1@news.povray.org>
Cesar wrote:
> (andit was expected, using ascii to represent the number
> has nothing to do with precision).

Be carful: The (decimal) ascii representation is not equal to the binary 
representation (you can't, for example, represent decimal 0.1 as a 
binary floating point number) - see 
http://docs.sun.com/source/806-3568/ncg_goldberg.html

But still, I did not have any "Camera vectors are not perpendicular" 
problems when using double precision to compute them.

> Ah! Is there a similar way to specify object position? without specifying a
> rotation (and using directing vectors instead)?

You can use a transformation matrix directly. If your external 
application uses matrices, that would make sense. Check the POV docs for 
the "matrix" keyword.


Post a reply to this message

From: Cesar
Subject: Re: Positioning a camera
Date: 19 Apr 2005 13:10:01
Message: <web.42653a9e1c98b29babdc606d0@news.povray.org>
> Be carful: The (decimal) ascii representation is not equal to the binary
> representation (you can't, for example, represent decimal 0.1 as a
> binary floating point number) - see
> http://docs.sun.com/source/806-3568/ncg_goldberg.html

But you can get so close it's the same (unless, like I said, you use the
values again and again until it degenerates) :o) It doesn't matter. My
problem is solved and I can only say thanks for the help.


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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