POV-Ray : Newsgroups : povray.advanced-users : camera math help please Server Time
30 Jul 2024 18:17:37 EDT (-0400)
  camera math help please (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Arthur Flint
Subject: camera math help please
Date: 24 Jul 1999 15:46:30
Message: <379A1910.98B51D61@gci.net>
I have been working with placing a camera on the surface of a sphere
on a random position. I would like the camera to be aligned so that
the the surface is "down". I guess that "up" would be the vector to
rotate
around to view the surface.
Assuming a vector of SurfaceDirection as "up", what are the prameters
for the camera?
-- 
Advanced means constantly wondering where reality gets its processing
power.


Post a reply to this message

From: Bob Hughes
Subject: Re: camera math help please
Date: 24 Jul 1999 16:01:57
Message: <379A1B7D.F3FF970D@aol.com>
Re-reading your idea there I still wasn't positive of what you are
trying. However as far as moving the camera around to any point on a
surface of a sphere you are going to run into something awkward about
the camera orientations. When it reaches a point perpindicular enough to
a plane it will switch scene directions abruptly. I don't know enough to
help, just wanted to bring that up.


Arthur Flint wrote:
> 
> I have been working with placing a camera on the surface of a sphere
> on a random position. I would like the camera to be aligned so that
> the the surface is "down". I guess that "up" would be the vector to
> rotate
> around to view the surface.
> Assuming a vector of SurfaceDirection as "up", what are the prameters
> for the camera?
> --
> Advanced means constantly wondering where reality gets its processing
> power.

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto://inversez@aol.com?Subject=PoV-News


Post a reply to this message

From: Arthur Flint
Subject: Re: camera math help please
Date: 24 Jul 1999 16:18:28
Message: <379A208F.4E3EE7FD@gci.net>
I know that you can force the camera into any orientation using 
the sky and look_at keywords, or the direction keyword.
The question is, who do you leave the the sphere alone
and re-orient the camera so that it looks like you are standing
on the surface.

Bob Hughes wrote:
> 
> Re-reading your idea there I still wasn't positive of what you are
> trying. However as far as moving the camera around to any point on a
> surface of a sphere you are going to run into something awkward about
> the camera orientations. When it reaches a point perpindicular enough to
> a plane it will switch scene directions abruptly. I don't know enough to
> help, just wanted to bring that up.
> 
 
Advanced means constantly wondering where reality gets its processing
power.


Post a reply to this message

From: ingo
Subject: Re: camera math help please
Date: 24 Jul 1999 18:33:50
Message: <379a3f4e@news.povray.org>
Is this what you're looking for?

#declare Radius= SphereRadius;
#declare Offset= WhatYouWant;

camera {
    location <0,Radius+Offset,0>
    look_at <0,Radius+Offset,Radius+Offset>
    rotate <random, random, random>
}

ingo
--
Met dank aan de muze met het glazen oog.
Arthur Flint heeft geschreven in bericht <379A1910.98B51D61@gci.net>...
>I have been working with placing a camera on the surface of a sphere
>on a random position. I would like the camera to be aligned so that
>the the surface is "down". I guess that "up" would be the vector to
>rotate
>around to view the surface.
>Assuming a vector of SurfaceDirection as "up", what are the prameters
>for the camera?
>--
>Advanced means constantly wondering where reality gets its processing
>power.


Post a reply to this message

From: Arthur Flint
Subject: Re: camera math help please
Date: 24 Jul 1999 21:14:08
Message: <379A65D7.D05C42EE@gci.net>
I think that it should be more like this:
camera	{
	location 0 
	sky SurfaceDirection 
	look_at vaxis_rotate( ?? , SurfaceDirection ,Degrees )
	angle 40 
	translate Surface*1.002
	}

The SurfaceDirection vector determines where on the sphere.
The Surface vector is the distance at that spot.
Degrees is how much to rotate around the SurfaceDirection vector.

Those Three I already have. Its those two question marks in
vaxis_rotate( ?? , SurfaceDirection ,Degrees ). They represent
a point on the plane at Surface distance from the center that is
tangent to the sphere.
The SurfaceDirection vector is the normal to a plane tangent to
the sphere. I need to find a point on that plane so I can point
look_at in the proper direction.

Does that help? Maybe I should try a different approach, maybe not.

Mr. Art
ingo wrote:
> 
> Is this what you're looking for?
> 
> #declare Radius= SphereRadius;
> #declare Offset= WhatYouWant;
> 
> camera {
>     location <0,Radius+Offset,0>
>     look_at <0,Radius+Offset,Radius+Offset>
>     rotate <random, random, random>
> }
> 
> ingo
> --
> Met dank aan de muze met het glazen oog.
> Arthur Flint heeft geschreven in bericht <379A1910.98B51D61@gci.net>...
> >I have been working with placing a camera on the surface of a sphere
> >on a random position. I would like the camera to be aligned so that
> >the the surface is "down". I guess that "up" would be the vector to
> >rotate
> >around to view the surface.
> >Assuming a vector of SurfaceDirection as "up", what are the prameters
> >for the camera?
> >--
> >Advanced means constantly wondering where reality gets its processing
> >power.

-- 
Advanced means constantly wondering where reality gets its processing
power.


Post a reply to this message

From: Steve
Subject: Re: camera math help please
Date: 25 Jul 1999 07:37:01
Message: <379AF853.E09ACD5E@puzzlecraft.com>
It's actually pretty simple. At zero degrees latitude the camera is
level at zero degrees rotation. The camera sits on the surface at the
radius of the sphere. If the camera is moved to 30 degrees latitude it
should be rotated 30 degrees to remain level with the horizon. As the
camera moves in longtitude it is rotated around the y-axis.

This is the same problem as polar aligning an equatorial telescope
mounting for astrophotography.

However, in POV-Ray we are not restricted to real-world constraints and
so we can avoid spherical navigation altogether by locating the camera
at the north pole and the rotating the sphere while the camera remains
stationary.

steve

Arthur Flint wrote:

> I have been working with placing a camera on the surface of a sphere
> on a random position. I would like the camera to be aligned so that
> the the surface is "down". I guess that "up" would be the vector to
> rotate
> around to view the surface.
> Assuming a vector of SurfaceDirection as "up", what are the prameters
> for the camera?
> --
> Advanced means constantly wondering where reality gets its processing
> power.


Post a reply to this message

From: Arthur Flint
Subject: Re: camera math help please
Date: 25 Jul 1999 11:59:38
Message: <379B356D.F893196@gci.net>
Steve,
	This was an attempt to get the positioning math right. I know that I
could have rotated the sphere, but then I never would have found the
right answer. And I am sure there must be one. So I keep looking.
Mr. Art

Steve wrote:
<snip>

> However, in POV-Ray we are not restricted to real-world constraints and
> so we can avoid spherical navigation altogether by locating the camera
> at the north pole and the rotating the sphere while the camera remains
> stationary.
> 
> steve
-- 
Advanced means constantly wondering where reality gets its processing
power.


Post a reply to this message

From: PoD
Subject: Re: camera math help please
Date: 25 Jul 1999 12:10:36
Message: <379B3706.43F4752D@merlin.net.au>
Arthur Flint wrote:
> 
> I think that it should be more like this:
> camera  {
>         location 0
>         sky SurfaceDirection
>         look_at vaxis_rotate( ?? , SurfaceDirection ,Degrees )
>         angle 40
>         translate Surface*1.002
>         }
> 
> The SurfaceDirection vector determines where on the sphere.
> The Surface vector is the distance at that spot.
> Degrees is how much to rotate around the SurfaceDirection vector.
> 
> Those Three I already have. Its those two question marks in
> vaxis_rotate( ?? , SurfaceDirection ,Degrees ). They represent
> a point on the plane at Surface distance from the center that is
> tangent to the sphere.
> The SurfaceDirection vector is the normal to a plane tangent to
> the sphere. I need to find a point on that plane so I can point
> look_at in the proper direction.
> 
> Does that help? Maybe I should try a different approach, maybe not.
> 
> Mr. Art
> ingo wrote:
> >
> > Is this what you're looking for?
> >
> > #declare Radius= SphereRadius;
> > #declare Offset= WhatYouWant;
> >
> > camera {
> >     location <0,Radius+Offset,0>
> >     look_at <0,Radius+Offset,Radius+Offset>
> >     rotate <random, random, random>
> > }
> >
> > ingo
> > --
> > Met dank aan de muze met het glazen oog.
> > Arthur Flint heeft geschreven in bericht <379A1910.98B51D61@gci.net>...
> > >I have been working with placing a camera on the surface of a sphere
> > >on a random position. I would like the camera to be aligned so that
> > >the the surface is "down". I guess that "up" would be the vector to
> > >rotate
> > >around to view the surface.
> > >Assuming a vector of SurfaceDirection as "up", what are the prameters
> > >for the camera?
> > >--
> > >Advanced means constantly wondering where reality gets its processing
> > >power.
> 
> --
> Advanced means constantly wondering where reality gets its processing
> power.

You might want to look at John VanSyckle's matrix macros
http://users.erols.com/vansickl/macs.zip
I think the Reorient macro does what you want.

Cheers, PoD.


Post a reply to this message

From: Arthur Flint
Subject: Re: camera math help please
Date: 25 Jul 1999 13:51:35
Message: <379B4FAB.7C73E8B4@gci.net>
Yes!!!
	Thanks guys. Talking it out with others helped.
here is code that works:
#local Norm = <0,0,0>;
#local Degrees = 0;
#local SurfaceDirection =<-1,0-1,>;
#local SD = vnormalize(SurfaceDirection);
#local Surface = trace(testobject,0,SurfaceDirection,Norm);
// yes, the trace function from Superpatch. testobject: first a sphere,
then the world!
camera	{
	location 0 look_at z
	rotate <-90,90,0>
	translate -x*vlength(Surface)*1.01
	look_at <-vlength(Surface),2000,0>
	rotate <0,0,degrees(acos(SD.y))>
	rotate <0,degrees(acos(SD.z)),0>
	rotate vaxis_rotate(Surface,SurfaceDirection,90)
	angle 50 
	}


Arthur Flint wrote:
> 
> Steve,
>         This was an attempt to get the positioning math right. I know that I
> could have rotated the sphere, but then I never would have found the
> right answer. And I am sure there must be one. So I keep looking.
> Mr. Art
> 

-- 
Advanced means constantly wondering where reality gets its processing
power.


Post a reply to this message

From: Uwe Zimmermann
Subject: Re: camera math help please
Date: 26 Jul 1999 07:49:00
Message: <379C4B2B.DE5D684C@ele.kth.se>
> // yes, the trace function from Superpatch. testobject: first a sphere,
> then the world!

You don't need Superpatch at all!

Given your position on the sphere in longitude (phi) and lattitude (psi)
and the horizontal based direction of view in azimut (0 degrees north,
90 degrees east ...) and height (0 degrees horizon, 90 degrees zenit)
you get the direction of view in cartesian coordinates (left handed, y
up - for POV) with the following few lines. If you are just looking for
the horizontal orientation of your camera, you just set the height to
zero and the azimut to the desired direction. You can then use the
vector zenit which stands perpendicular on the sphere as the upward
direction of your camera.

#declare degree=pi/180;   /*  I know that there is a function "rad", 
                              but I think this is more readable */
                                                                              
#declare phi=0*degree;  
#declare
psi=-60*degree;                                                        
#declare r=1.002;

#declare azimut=0*degree;
#declare height=0*degree;

#declare position= r * < cos(psi)*cos(phi), sin(psi),
-cos(psi)*sin(phi)>;
#declare zenit   =     < cos(psi)*cos(phi), sin(psi),
-cos(psi)*sin(phi)>;

#declare north   =     <-sin(psi)*cos(phi), cos(psi), 
sin(psi)*sin(phi)>;
#declare east    =     < sin(phi)         , 0       ,  cos(phi)        
>;

#declare direct  = north*cos(azimut) + east*sin(azimut) +
zenit*sin(height);



Uwe.


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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