POV-Ray : Newsgroups : povray.general : Keep the text oriented toward the camera Server Time
25 Nov 2024 15:53:19 EST (-0500)
  Keep the text oriented toward the camera (Message 1 to 7 of 7)  
From: YoM
Subject: Keep the text oriented toward the camera
Date: 15 Jan 2014 03:50:00
Message: <web.52d64acd64216e2b21263ef70@news.povray.org>
Hello,


I want to display a text at a given position but I want to keep it oriented
toward the camera.
I really don't know how to do it, which type of transformation I have to do ...

Here is an example of my problem:

#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"

// finish options
#declare ambientCoef = 0.2;
#declare diffuseCoef = 0.8;
#declare specularCoef = 0.8;

camera {
  perspective
  location  <22.424428, 27.372077, 22.881150>
  sky  <-0.190369, 0.724010, -0.663000>
  right -x*image_width/image_height
  angle  30.000000*image_width/image_height
  look_at  <1.214010, 0.842058, 0.000000>
}

light_source {
  <22.424428, 27.372077, 22.881150>
  color  <1.0, 1.0, 1.0>*0.8
}

background {
  color rgb  <1.000000, 1.000000, 1.000000>
}

sphere {
  <-2.311276, -3.133184, 0.000000> 0.100000
  texture
  {
    pigment { rgb <1.000000, 1.000000, 0.188235> }
    finish {ambient ambientCoef diffuse diffuseCoef specular specularCoef}
  }
}


text {
  ttf "cyrvetic.ttf" "TEST" 0, 0
  pigment { Black }
  translate <-2.211276, -3.033184, 0.100000>
}


If someone has an idea.
Thanks,
YoM


Post a reply to this message

From: Stephen
Subject: Re: Keep the text oriented toward the camera
Date: 15 Jan 2014 04:01:27
Message: <52d64e67$1@news.povray.org>
On 15/01/2014 8:46 AM, YoM wrote:
> If someone has an idea.

Not only an idea but a solution.

screen.inc

http://www.povray.org/documentation/view/3.6.1/495/

-- 
Regards
     Stephen


Post a reply to this message

From: posfan12
Subject: Re: Keep the text oriented toward the camera
Date: 15 Jan 2014 04:45:59
Message: <52d658d7@news.povray.org>
On 1/15/2014 4:01 AM, Stephen wrote:
> On 15/01/2014 8:46 AM, YoM wrote:
>> If someone has an idea.
>
> Not only an idea but a solution.
>
> screen.inc
>
> http://www.povray.org/documentation/view/3.6.1/495/
>

I created an updated version of screen.inc here:

http://isometricland.net/povray/povray.php


---
This email is free from viruses and malware because avast! Antivirus protection is
active.
http://www.avast.com


Post a reply to this message

From: Stephen
Subject: Re: Keep the text oriented toward the camera
Date: 15 Jan 2014 04:56:07
Message: <52d65b37$1@news.povray.org>
On 15/01/2014 9:45 AM, posfan12 wrote:
> On 1/15/2014 4:01 AM, Stephen wrote:
>> On 15/01/2014 8:46 AM, YoM wrote:
>>> If someone has an idea.
>>
>> Not only an idea but a solution.
>>
>> screen.inc
>>
>> http://www.povray.org/documentation/view/3.6.1/495/
>>
>
> I created an updated version of screen.inc here:
>
> http://isometricland.net/povray/povray.php
>
>

That is good.Thanks for posting the link.


-- 
Regards
     Stephen


Post a reply to this message

From: YoM
Subject: Re: Keep the text oriented toward the camera
Date: 15 Jan 2014 05:45:01
Message: <web.52d665cec5b03d6721263ef70@news.povray.org>
Stephen <mca### [at] aolcom> wrote:
> On 15/01/2014 8:46 AM, YoM wrote:
> > If someone has an idea.
>
> Not only an idea but a solution.
>
> screen.inc
>
> http://www.povray.org/documentation/view/3.6.1/495/
>
> --
> Regards
>      Stephen

Thank you. Maybe I don't understand Screen_Object variables but with:
Screen_Object ( text {
  ttf "cyrvetic.ttf" "TEST" 0, 0
  pigment { Black }
  translate <-2.311276, -3.133184, 0.000000>
},<0,0>, <0.01,0.01>, true, 1 )

my text is still not oriented toward my camera.


Post a reply to this message

From: MichaelJF
Subject: Re: Keep the text oriented toward the camera
Date: 15 Jan 2014 10:35:01
Message: <web.52d6a9a4c5b03d678e0aa5d50@news.povray.org>
"YoM" <yoh### [at] gmailcom> wrote:
> Thank you. Maybe I don't understand Screen_Object variables but with:
> Screen_Object ( text {
>   ttf "cyrvetic.ttf" "TEST" 0, 0
>   pigment { Black }
>   translate <-2.311276, -3.133184, 0.000000>
> },<0,0>, <0.01,0.01>, true, 1 )
>
> my text is still not oriented toward my camera.

I think YoM will put a text object somewhere into the scene and adjust it with
the camera. Than the following code may be of help. May be it will not work with
every location and sky vector, but if not, exchanging the signs within the
Shear_Trans call should help. And it will adjust the first letter approximately
correct only. But for a short text setting the thickness to zero again it
should yield acceptable results.

The code uses transforms.inc which is included by shapes.inc here already.
Otherwise transforms.inc has to be included off course.

Best regards,
Michael

#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"

// finish options
#declare ambientCoef = 0.2;
#declare diffuseCoef = 0.8;
#declare specularCoef = 0.8;

#declare CamLoc = <22.424428, 27.372077, 22.881150>;
#declare CamSky = <-0.190369, 0.724010, -0.663000>;
#declare Cam_LA = <1.214010, 0.842058, 0.000000>;
camera {
  perspective
  location CamLoc
  sky  CamSky
  right -x*image_width/image_height
  angle  30.000000*image_width/image_height
  look_at  Cam_LA
}

light_source {
  <22.424428, 27.372077, 22.881150>
  color  <1.0, 1.0, 1.0>*0.8
}

background {
  color rgb  <1.000000, 1.000000, 1.000000>
}

#declare Farben = array[10]
#declare Farben[0] = Red;
#declare Farben[1] = Yellow;
#declare Farben[2] = Blue;
#declare Farben[3] = Green;
#declare Farben[4] = Cyan;
#declare Farben[5] = Magenta;
#declare Farben[6] = Orange;
#declare Farben[7] = Black;
#declare Farben[8] = SlateBlue;
#declare Farben[9] = YellowGreen;

#declare Zufall = seed(3187);
#for(i,1,25)
   #declare TextLowerLeft=<-2.211276, -3.033184, 0.100000>  //  your original
position of the text object
                            + <rand(Zufall)*10,rand(Zufall)*10,rand(Zufall)*10>;
// add a random compenent
   #declare TransVec1=vnormalize(TextLowerLeft-CamLoc);
   #declare TransVec2=vnormalize(vcross(TransVec1,CamSky));
   #declare TransVec3=vnormalize(vcross(TransVec1,TransVec2)); // for the case
that CamSky and Transvec1 are not perpendicular

   text {
     ttf "cyrvetic.ttf" "Test" 1, 0  // increased thickness for testing the
orientation
                                     // only the first letter will
     pigment { Farben[int(rand(Zufall)*9.99)] }

      Shear_Trans(TransVec2,-TransVec3,TransVec1) translate TextLowerLeft
   }
#end


Post a reply to this message

From: YoM
Subject: Re: Keep the text oriented toward the camera
Date: 16 Jan 2014 10:50:01
Message: <web.52d7fed6c5b03d6721263ef70@news.povray.org>
Exactly what I need Mickael !
Thank you very much !


Post a reply to this message

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