POV-Ray : Newsgroups : povray.animations : Camera question/Simple Animation Server Time
29 Jul 2024 00:31:29 EDT (-0400)
  Camera question/Simple Animation (Message 1 to 4 of 4)  
From: islam
Subject: Camera question/Simple Animation
Date: 6 Jul 1998 09:06:13
Message: <35A0BC05.41C6@icrf.icnet.uk>
I would like to do very simple animations by keeping the object
fixed at the origin and translating/rotating the camera along a
defined curve. For example have the camera move in a circle in
the X-Z plane. I must be doing something very silly because strange
things start to happen after a 90degree rotation. Here is the
psedo code for my program:

/* ROTATE CAMERA AROUND Y-AXIS ABOUT ORIGIN */

lxo = 0. ; lyo = 0. ; lyo = 50. /* camera start xyz location */
rxo = 1. ; ryo = 0. ; rzo = 0.  /* right axis start xyz location */

for i = start-angle , end-angle
{

create_new_pov_input_file_i

/* rotate camera location and right x & z */

lx = cos(i).lxo - sin(i).lzo	 
lz = sin(i).lxo + cos(i).lzo	 
rx = cos(i).rxo - sin(i).rzo	 
rz = sin(i).rxo + cos(i).rzo	 

write-camera:
 camera {
 location <   lx,ly,lz>
 look_at  <   0.,0.,0.>
 up       <   0.,1.,0.>
 right    <   rx,ry,rz>
 orthographic}

write_out_scene_data

}

Any help/comments much appreciated. Thanks
____________________________________________
Suhail A Islam
Biomolecular Modelling Laboratory
Imperial Cancer Research Fund, P.O. Box 123
44 Lincoln's Inn Fields, London WC2A 3PX
Tel: (0171) 269 3380 
Fax: (0171) 269 3258
email: isl### [at] icrficnetuk
http://www.icnet.uk/bmm/
____________________________________________


Post a reply to this message

From: Mark Donovan
Subject: Re: Camera question/Simple Animation
Date: 7 Jul 1998 07:29:42
Message: <35A1F879.FEBC2E12@worldnet.att.net>
Hi Suhail,

The solution is much simpler than the method you've tried. It's not necessary
to recompute the 'right' camera vector for each animation frame. Instead, set
the 'up' and 'right' vectors to match area you want to display and the aspect
ratio for the frame. Next, rotate the camera into position for each frame. The
'location', 'up' and 'right' statements are constants; change only the
'rotate' for each frame. Here's the camera statement for your example.

camera { orthographic
  location  <0.0, 0.0, 50.0>
  up        1.0*y
  right     1.0*4/3*x  // sets aspect ratio for frame
  look_at   <0.0, 0.0, 0.0>
  rotate    360*clock*y
}

This displays an area 1.0 units high by 1.0*4/3 wide at the origin with the
camera making one complete circle in the X-Z plane. If you don't want a full
circle around the origin, try something like:

  rotate    ((end_angle - start_angle)*clock + start_angle)*y

Mark
Phoenix, Arizona USA

In povray.animations isl### [at] icrficnetuk wrote:
> 
> I would like to do very simple animations by keeping the object
> fixed at the origin and translating/rotating the camera along a
> defined curve. For example have the camera move in a circle in
> the X-Z plane. I must be doing something very silly because strange
> things start to happen after a 90degree rotation. Here is the
> psedo code for my program:
> 
> /* ROTATE CAMERA AROUND Y-AXIS ABOUT ORIGIN */
> 
> lxo = 0. ; lyo = 0. ; lyo = 50. /* camera start xyz location */
> rxo = 1. ; ryo = 0. ; rzo = 0.  /* right axis start xyz location */
> 
> for i = start-angle , end-angle
> {
> 
> create_new_pov_input_file_i
> 
> /* rotate camera location and right x & z */
> 
> lx = cos(i).lxo - sin(i).lzo
> lz = sin(i).lxo + cos(i).lzo
> rx = cos(i).rxo - sin(i).rzo
> rz = sin(i).rxo + cos(i).rzo
> 
> write-camera:
>  camera {
>  location <   lx,ly,lz>
>  look_at  <   0.,0.,0.>
>  up       <   0.,1.,0.>
>  right    <   rx,ry,rz>
>  orthographic}
> 
> write_out_scene_data
> 
> }


Post a reply to this message

From:
Subject: Re: Camera question/Simple Animation
Date: 31 Jul 1998 22:34:31
Message: <35c270a7.0@news.povray.org>
islam skrev i meddelelsen <35A### [at] icrficnetuk>...
>I would like to do very simple animations by keeping the object
>fixed at the origin and translating/rotating the camera along a
>defined curve. For example have the camera move in a circle in
>the X-Z plane. I must be doing something very silly because strange
>things start to happen after a 90degree rotation. Here is the
>psedo code for my program:
>
>/* ROTATE CAMERA AROUND Y-AXIS ABOUT ORIGIN */
>
>lxo = 0. ; lyo = 0. ; lyo = 50. /* camera start xyz location */
>rxo = 1. ; ryo = 0. ; rzo = 0.  /* right axis start xyz location */
>
>for i = start-angle , end-angle
>{
>
>create_new_pov_input_file_i
>
>/* rotate camera location and right x & z */
>
>lx = cos(i).lxo - sin(i).lzo
>lz = sin(i).lxo + cos(i).lzo
>rx = cos(i).rxo - sin(i).rzo
>rz = sin(i).rxo + cos(i).rzo
>
>write-camera:
> camera {
> location <   lx,ly,lz>
> look_at  <   0.,0.,0.>
> up       <   0.,1.,0.>
> right    <   rx,ry,rz>
> orthographic}
>
>write_out_scene_data
>
>}
>
>Any help/comments much appreciated. Thanks
>____________________________________________
>Suhail A Islam
>Biomolecular Modelling Laboratory
>Imperial Cancer Research Fund, P.O. Box 123
>44 Lincoln's Inn Fields, London WC2A 3PX
>Tel: (0171) 269 3380
>Fax: (0171) 269 3258
>email: isl### [at] icrficnetuk
>http://www.icnet.uk/bmm/
>____________________________________________

Hi there, Suhail...
Try place the whatever it is you want the camera to circle around, at the
position <0,0,0>, and then "apply" the camera like this:

camera {
    location <0,0,-5>
    look_at <0,0,0>
    rotate <0,360*clock,0>
    }

This makes the camera keep on looking at the object(s) at <0,0,0>, and make
one full circle with radius 5 around the object(s), as clock propagates from
0 to 1
This should work all 360 degrees around...

Happy tracin'...


Post a reply to this message

From: Chris
Subject: Re: Camera question/Simple Animation
Date: 31 Aug 1998 21:32:40
Message: <35eb40a8.0@news.povray.org>
G'day,

>I would like to do very simple animations by keeping the object
>fixed at the origin and translating/rotating the camera along a
>defined curve. For example have the camera move in a circle in
>the X-Z plane. I must be doing something very silly because strange
>things start to happen after a 90degree rotation.

Yes, this sends me back to highschool!  I tried to draw (and rotate) a 3d
object on an Amiga!

This is what happens.  I can't tell you why (ask a math student!)

from 0 - 90 everything seems fine!  Then, from 90 to 180, cos becomes
negative.

So when you are between 90 - 180, make deg = 90 - (angle - 90)

Same thing from 180 - 270 and 270 - 360

The way I worked around it was by changing putting a couple of "if"
statements.  Like above, when ang >90 and <= 180 then deg = 90 - (angle -
90) etc.

Make sense?

Chris Payne
Melbourne, Australia
www.teksupport.net.au/~chris


Post a reply to this message

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