prev index next 
Animation 
 POV-Ray Tips, 
 Tricks, and Techniques
Compass Headings in Animation? 
 
Todd Pattist muses: In a previous post, I described how as part of my preflight planning for some long glider flights along the ridges in Pennsylvania I have been using POV-Ray to do fly-thru simulations along a spline path.  The fly-thrus are done over height fields generated from actual terrain data with digital maps overlying them to show the location of rivers, roads and towns.

I animate the resulting views, then study them so that when I actually fly them, I will know what to expect around each bend of the ridge.

In that post, I was looking for help on animation, and the flexibility of POV-Ray's pre  frame commands, coupled with a simple Basic program to generate the next frame number and run some programs solved my problems.  The new POV-Ray is certainly nice to work with.

I'd now like to add some compass headings to my animations so I can see when the spline path of the flight is headed north, and when it turns west, etc.  I've considered two methods: One is to add a large object that I can see (like a cylinder labeled "North") on the X axis.  The other is to try using a sphere as the sky with an image of a compass rose applied to it.

The first method suffers from parallax problems unless I put the objects really far out and make them huge.  I'm also having trouble with the second method.  I'm not really sure how to apply an image to the skysphere.  Can I just map it on?
 

Chris Colefax has a better idea:
If you want some sort of indicator that remains on screen throughout the animation, why not create an object that is positioned relative to the camera?  From this post, I assume you are still using SP, which (if I remember correctly from your old post) means you are assigning the current camera location for each frame to a variable.  You could use this variable as the basis for the position of the compass needle.  The following example assumes that +y is up, and +z is north:

  #declare CompassNeedle = union {
     cylinder {<0,0,0>, <0,0,10>, 1 pigment {rgb <1,1,1>}}
     cylinder {<0,0,0>, <10,0,0>, .5 pigment {rgb <1,0,0>}}
     cylinder {<0,0,0>, <0,0,-10>, .5 pigment {rgb <0,1,0>}}
     cylinder {<0,0,0>, <-10,0,0>, .5 pigment {rgb <0,0,1>}}}

  camera {location CurCameraLocation look_at CurCameraLook_at}
  object {CompassNeedle
    translate CurCameraLocation + (<10,-10,10> *
      vnormalize (CurCameraLook_at - CurCameraLocation))}

Obviously you will have to fiddle with the numbers, but a similar sort of method could be used to place a colour-coded compass star such that it always appears at the bottom of the screen.  Because you are only translating the needle and not rotating it, the thicker white bar will always point north, the red bar will point east, etc.

With a little more effort you could create a needle in the XY-plane (instead of the XZ-plane as above) that is first rotated by the angle between the camera_location and look_at vectors, then placed so that it sits in the bottom right-hand corner of the screen.

BTW, you can use an image_map to place a bitmap on a sky_sphere, and if you can be sure that the sky will always be in view this will give a similar result to the first idea I mentioned.
 

  1