|
|
Hello,
My goal is to place text on an image at a certain position known by its
3d coordinates. With classic "screen.inc" this code do the job :
---
#include "screen.inc" // standard inc file
Set_Camera(<25,15,-33>, <2,2,0>, 70) // set location, look_at and angle
Set_Camera_Aspect(4,3) // set width in relation to height
Set_Camera_Sky(<0,1,0.3>) // set the sky vector
#declare MyTextObject = text {...}
Screen_Object ( MyTextObject, <0.00, 0.50>, <0.01,0.01>, true, 0.01 )
---
I found the "Updated screen.inc" in newsgroup.
<http://news.povray.org/povray.text.scene-files/attachment/%3C5b889a96%40news.povray.org%3E/screen.inc.txt>
In this file there's the macro : *Get_Screen_XY(Loc)*. This macro return
<x,y> coordinates in the image from <x,y,z> coordinates of 3d scene.
That's exactly what I need.
I update my code to :
---
#include "screen2.inc" // updated inc file from newsgroup
Set_Camera(<25,15,-33>, <2,2,0>, 70) // set location, look_at and angle
Set_Camera_Aspect(4,3) // set width in relation to height
Set_Camera_Sky(<0,1,0.3>) // set the sky vector
#declare MyTextObject = text {...}
#declare Point3D = <a,b,c>;
// here, screenXY contain the right "image coordinates"
// like <400,300> for center of an image 800x600
#declare screenXY = Get_Screen_XY(Point3D);
// because Screen_Object use <u,v> from 0..1, i calc
#declare screenU = screenXY.x/image_width;
#declare screenV = screenXY.y/image_height;
// which produces <0.50, 0.50> always for the center
// and now, display text at this pos
Screen_Object ( MyTextObject, <screenU, screenV>, <0.01,0.01>, true, 0.01 )
---
and, uh... nothing shows up !
where's my mistake? Is there a bug in the macro or in my code ?
if you have any ideas...
thanks
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
|
|