POV-Ray : Newsgroups : povray.newusers : Placing a stopwatch in a fixed position on the image : Re: Placing a stopwatch in a fixed position on the image Server Time
5 Nov 2024 05:20:46 EST (-0500)
  Re: Placing a stopwatch in a fixed position on the image  
From: John VanSickle
Date: 27 Sep 2000 08:22:22
Message: <39D1E67D.A5F697DD@erols.com>
Bill Brehm wrote:
> 
> I want to place a stop watch type counter in the lower right corner of
> an animation. I has the animation working and the stop watch text too.
> I have some problems:
> 
> 1) I can't figure out the formula for rotating a text object so it is
> parallel to the image plane and upright as the camera sees it. I've
> tried all kinds of vector functions, be can't figure it out.

It's simpler to use a matrix transform.  All but one of my IRTC entries
has subtitling of some kind, so I make heavy use of this.

> 2) Ideally, the rotation and position and size of the text object
> should be based on camera parameters, like look_at and position and
> sky, etc., so I can move the camera and have the stopwatch stay in the
> same location on the images.

This is how I do it.

#declare CamSky=y;
#declare CamZoom=2.5; // the length of the direction vector in the
                      // camera

// if you're accustomed to setting the zoom with the angle setting, then
// use this line to set the camera zoom instead:
#declare CamZoom=.5/tan(radians(CameraAngle/2));

#declare CamLoc=MyCameraLocation; // wherever you're putting it
#declare CamEye=MyCameraLookAt; // wherever you're looking

#local CamD=vnormalize(CamEye-CamLoc); // direction of camera view
#local CamR=vnormalize(vcross(CamSky,CamD)); // to the right
#local CamU=vnormalize(vcross(CamD,CamR)); // camera up

camera {
  direction CamD*CamZoom
  right CamR*4/3 // 4/3 is my aspect ratio
  up CamU
  location CamLoc
}

sphere { <2/3-.05,1/2-.05,CamZoom>,.025
  no_shadow // subtitling shouldn't cast shadows in the scene
  pigment { rgb <1,1,0> }
  finish { ambient 1 diffuse 0 } // keeps appearance consistent as
                                 // camera moves
  matrix < CamR.x,  CamR.y,  CamR.z,
           CamU.x,  CamU.y,  CamU.z,
           CamD.x,  CamD.y,  CamD.z,
           CamLoc.x,CamLoc.y,CamLoc.z >
}

> 3) I want to do the stopwatch in such a way that it doesn't have any
> perspective distortion. Ideally, it should look like it was
> superimposed on the image after the rendering.

This is only a problem with a wide camera angle, and then only if your
object is lengthy along the z axis.

> Any help is appreciated. Thanks, Bill.

Hope this helps,
John


Post a reply to this message

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