POV-Ray : Newsgroups : povray.animations : Camera question/Simple Animation : Re: Camera question/Simple Animation Server Time
28 Jul 2024 22:24:01 EDT (-0400)
  Re: Camera question/Simple Animation  
From: Mark Donovan
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

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