POV-Ray : Newsgroups : povray.general : Making labels that don't rotate while object does : Re: Making labels that don't rotate while object does Server Time
8 Aug 2024 14:24:26 EDT (-0400)
  Re: Making labels that don't rotate while object does  
From: David Mathog
Date: 7 Nov 2001 13:24:01
Message: <3BE97C41.D2768D32@caltech.edu>
ingo wrote:

> David Mathog wrote:
>
> >......
> >Then I try to put labels into the frame so that they are stable in the
> >viewed frame.
>
> If it helps, here's a bit by John VanSickle, couldn't find the original so
> copied it from a scene.
>
> ////// this part by John van Sickle
> #local CamL= <0,1.6,-5>; //where the camera's location is
> #local CamE= <0,0,0>;   //where the camera's look_at is
> #local CamZ= 2;         //the amount of camera zoom you want
>
> #local CamD= vnormalize(CamE-CamL);
> #local CamU= vnormalize(vcross(CamD,CamR));
>
> text { ttf "arial.ttf","Your Text",0.01,0
>    texture { pigment {rgb 12} }
>    scale .1
>    translate < 0.3,-0.45, CamZ>
>    matrix < CamR.x, CamR.y, CamR.z,
>             CamU.x, CamU.y, CamU.z,
>             CamD.x, CamD.y, CamD.z,
>             CamL.x, CamL.y, CamL.z >
> }
>
> camera {
>    location CamL
>    up CamU
>    right CamR*4/3
>    direction CamD*CamZ
> }
> ///////
>
> Ingo
>
> --
> Photography: http://members.home.nl/ingoogni/
> Pov-Ray    : http://members.home.nl/seed7/

I just noticed that this routine only works with the default "sky" value.
 When other
sky values are used the text is still flush, but is rotated around the center
of the image.
This dependence on the default sky is implicit in the line:

#local CamR= vnormalize(vcross(y,CamD));

The more general form is:

#local CamR= vnormalize(vcross(skyvector,CamD));

where skyvector is whatever shows up in the camera statement.  Since
skyvector will
normally be perpendicular to CamD it should work ok.  If you use an arbitrary
skyvector
it might be parallel to CamD, in which case all bets are off!  Here's a bit
of one of my POV files
that shows the results of this calculation:

   text{ttf "timrom.ttf", "Sheet 2",0.0,0.0
     texture{ pigment{ colour red 1.00 green 0.00 blue 0.00 }finish{
LABEL_FINISH }} scale<   1.651,   1.651,   1.651>
     translate <   0.826,  -0.826,0>
     matrix <
       -0.0100,   -0.3265,   -0.9452,
        0.1905,   -0.9285,    0.3187,
       -0.9816,   -0.1769,    0.0715,
        8.0728,   19.3232,  -11.2022
     >
   }
//************ CAMERA *********
camera { location  <  190.6901,   34.5692,  -20.0225>
         sky       <    0.1905,   -0.9285,    0.3187>
         up        <    0.1905,   -0.9285,    0.3187>
         right     <   -0.0133,   -0.4353,   -1.2602>
         direction <   -0.9816,   -0.1769,    0.0715>
         look_at   <   10.1880,    2.0380,   -6.8790>
         angle 20
}


Regards,

David Mathog
mat### [at] caltechedu
Manager, Sequence Analysis Facility, Biology Division, Caltech


Post a reply to this message

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