POV-Ray : Newsgroups : povray.general : Automatic copyright text - need math help Server Time
13 Aug 2024 09:34:44 EDT (-0400)
  Automatic copyright text - need math help (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Lewis Sellers
Subject: Automatic copyright text - need math help
Date: 9 Oct 1998 03:46:03
Message: <361DB143.3DD7389F@usit.net>
Well, I was trying to do this myself, but my math is so weak it'll take
me forever.... :)


Ok. I was trying to make it so that the small text "Copyright 1998 by
Lewis Sellers" would automatically be placed in the bottom left of any
scene I rendered no matter the camera positions. Very handy in
animations, etc.

In the snip of code below, you'll see I declare cam_l for the camera
location value and cam_lat for the camera look_at value. Using those two
positions I try to compute the translate and rotate needed to position
the text properly.

I managed to get the text roughly where it needs to be, but can't figure
out how to rotate it.

If anyone who's mathematically endowed can help, I'd appreciate it. This
could be a neat little piece of code to plug in for everyone to
autoinsert copyrights on our pics during rendering. :-)
--min

//
#declare cam_l = <125,8,-2>;
#declare cam_lat = <0,0,0>;

camera {
    location  cam_l
    look_at cam_lat
    angle 90
}
                                     
#declare camc=vnormalize(cam_lat-cam_l);

//put up the copyright now matter where the darn camera is!
#debug concat(".x :", str(cam_l.x,5,2), "\n")
#debug concat(".y :", str(cam_l.y,5,2), "\n")
#debug concat(".z :", str(cam_l.z,5,2), "\n")
#debug "\n"                                               

#debug concat("camc.x :", str(camc.x,5,2), "\n")
#debug concat("camc.y :", str(camc.y,5,2), "\n")
#debug concat("camc.z :", str(camc.z,5,2), "\n")
#debug "\n"                                               
text {
    ttf "timrom.ttf" "Copyright 1998 by Lewis Sellers" .01, 0
    pigment { rgbt<1,0,0,1> }
    translate cam_l
    translate camc  
    rotate<camc.x*360,0,0> //camc.y*360,camc.z*360>
    no_shadow
}                               


-- 
Lewis A. Sellers: writer and contract Multimedia Website Developer
mailto:lse### [at] usitnet (The Fourth Millennium Foundation)
http://www.public.usit.net/lsellers/ & http://www.intrafoundation.com
http://brain-of-pooh.tech-soft.com/users/critters/bios/sellers_lewis.html

You can bug the living bejesus out of me live on ICQ @ 491461
(If I don't get back to you within a month, I'm out of prozac in some
dark corner somewhere screaming things quite unintelligable but -- most
curiously -- thick with a sumerian accent.)

"The comedy is over" -i pagliacci


Post a reply to this message

From: Nathan Kopp
Subject: Re: Automatic copyright text - need math help
Date: 9 Oct 1998 14:31:59
Message: <361E486D.78A4FCB8@ltu.edu>
There's actually a LOT of math involved in that, especially if you want to
handle all sorts of sky vectors (rolling the camera).  Luckily for you, the
math has been done already.  I did it for my lens flare include file, and
adapted it for a "background" INC file (yet to be released).

The background.inc file creates a plane with a user-defined texture which is
lined up with the camera's view at a user-defined distance from the camera. 
The math would basically be the same for putting everything in foreground, but
the user would specify a much shorter distance and probably want to clip the
plane (or use a different object, like a text object).

I'll post here again when I finish cleaning up the INC files.

-Nathan

Lewis Sellers wrote:
> 
> Well, I was trying to do this myself, but my math is so weak it'll take
> me forever.... :)
> 
> Ok. I was trying to make it so that the small text "Copyright 1998 by
> Lewis Sellers" would automatically be placed in the bottom left of any
> scene I rendered no matter the camera positions. Very handy in
> animations, etc.
> 
> In the snip of code below, you'll see I declare cam_l for the camera
> location value and cam_lat for the camera look_at value. Using those two
> positions I try to compute the translate and rotate needed to position
> the text properly.
> 
> I managed to get the text roughly where it needs to be, but can't figure
> out how to rotate it.
> 
> If anyone who's mathematically endowed can help, I'd appreciate it. This
> could be a neat little piece of code to plug in for everyone to
> autoinsert copyrights on our pics during rendering. :-)
> --min
> 
> //
> #declare cam_l = <125,8,-2>;
> #declare cam_lat = <0,0,0>;
> 
> camera {
>     location  cam_l
>     look_at cam_lat
>     angle 90
> }
> 
> #declare camc=vnormalize(cam_lat-cam_l);
> 
> //put up the copyright now matter where the darn camera is!
> #debug concat(".x :", str(cam_l.x,5,2), "\n")
> #debug concat(".y :", str(cam_l.y,5,2), "\n")
> #debug concat(".z :", str(cam_l.z,5,2), "\n")
> #debug "\n"
> 
> #debug concat("camc.x :", str(camc.x,5,2), "\n")
> #debug concat("camc.y :", str(camc.y,5,2), "\n")
> #debug concat("camc.z :", str(camc.z,5,2), "\n")
> #debug "\n"
> text {
>     ttf "timrom.ttf" "Copyright 1998 by Lewis Sellers" .01, 0
>     pigment { rgbt<1,0,0,1> }
>     translate cam_l
>     translate camc
>     rotate<camc.x*360,0,0> //camc.y*360,camc.z*360>
>     no_shadow
> }
> 
> --
> Lewis A. Sellers: writer and contract Multimedia Website Developer
> mailto:lse### [at] usitnet (The Fourth Millennium Foundation)
> http://www.public.usit.net/lsellers/ & http://www.intrafoundation.com
> http://brain-of-pooh.tech-soft.com/users/critters/bios/sellers_lewis.html
> 
> You can bug the living bejesus out of me live on ICQ @ 491461
> (If I don't get back to you within a month, I'm out of prozac in some
> dark corner somewhere screaming things quite unintelligable but -- most
> curiously -- thick with a sumerian accent.)
> 
> "The comedy is over" -i pagliacci


Post a reply to this message

From: Peter Popov
Subject: Re: Automatic copyright text - need math help
Date: 9 Oct 1998 22:51:47
Message: <361ebdb3.0@news.povray.org>
I have done what you're trying to with Chris Colefax's lens flares include
file. See the thread "animated credits, on-screen display" starting 08/20/98
in povray.animations

Peter


Post a reply to this message

From: Lewis Sellers
Subject: Re: Automatic copyright text - need math help
Date: 9 Oct 1998 23:26:11
Message: <361EC5DF.6D1314A@usit.net>
Nathan Kopp wrote:
> 
> There's actually a LOT of math involved in that, especially if you want to
> handle all sorts of sky vectors (rolling the camera).  Luckily for you, the
> math has been done already.  I did it for my lens flare include file, and
> adapted it for a "background" INC file (yet to be released).

Ah. I haven't looked at any lens flare files yet, but as I was doing the
copyright text thing I was thinking, you know, that might be how they do
those lens flare thingies.... :)

> The background.inc file creates a plane with a user-defined texture which is
> lined up with the camera's view at a user-defined distance from the camera.
> The math would basically be the same for putting everything in foreground, but
> the user would specify a much shorter distance and probably want to clip the
> plane (or use a different object, like a text object).
> 
> I'll post here again when I finish cleaning up the INC files.
> 
> -Nathan
> 

Looking forward to it. In the meantime I'll see if I can assimilate some
lens flaring code... :)


-- 
Lewis A. Sellers: writer and contract Multimedia Website Developer
mailto:lse### [at] usitnet (The Fourth Millennium Foundation)
http://www.public.usit.net/lsellers/ & http://www.intrafoundation.com
http://brain-of-pooh.tech-soft.com/users/critters/bios/sellers_lewis.html

You can bug the living bejesus out of me live on ICQ @ 491461
(If I don't get back to you within a month, I'm out of prozac in some
dark corner somewhere screaming things quite unintelligable but -- most
curiously -- thick with a sumerian accent.)

"The comedy is over" -i pagliacci


Post a reply to this message

From: John VanSickle
Subject: Re: Automatic copyright text - need math help
Date: 10 Oct 1998 14:27:23
Message: <361FA0EC.9C210BC5@erols.kosher.com>
Lewis Sellers wrote:
> 
> Well, I was trying to do this myself, but my math is so weak it'll take
> me forever.... :)
> 
> Ok. I was trying to make it so that the small text "Copyright 1998 by
> Lewis Sellers" would automatically be placed in the bottom left of any
> scene I rendered no matter the camera positions. Very handy in
> animations, etc.

#local CamE = <0,0,0>; //where the camera's look_at is
#local CamL = <10,12,1>; //where the camera's location is
#local CamZ = 2; //the amount of camera zoom you want

#local CamD = vnormalize(CamE-CamL);
#local CamR = vnormalize(vcross(y,CamD));
#local CamU = vnormalize(vcross(CamD,CamR));

text { ttf "cyrvetic.ttf","(c) 1998 by Lewis Sellers",.01,0
  texture { YourTexture }
  scale .1
  translate <-.65,-.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
}        

Hope this helps,
John

-- 
"He has the power to rear-project major cities!" -- Mike Nelson


Post a reply to this message

From: Lewis Sellers
Subject: Re: Automatic copyright text - need math help
Date: 11 Oct 1998 07:14:15
Message: <3620850F.62B399B4@usit.net>
John VanSickle wrote:
> 
> Hope this helps,
> John

Works nicely in fact. 

I had no idea there was a "matrix" keyword until I saw it there. Not
that I would have known what to do with it though. But, I learned
something new today. :)

You should make it a standard .inc file if you haven't already.

danke,
--min


-- 
Lewis A. Sellers: writer and contract Multimedia Website Developer
mailto:lse### [at] usitnet (The Fourth Millennium Foundation)
http://www.public.usit.net/lsellers/ & http://www.intrafoundation.com
http://brain-of-pooh.tech-soft.com/users/critters/bios/sellers_lewis.html

You can bug the living bejesus out of me live on ICQ @ 491461
(If I don't get back to you within a month, I'm out of prozac in some
dark corner somewhere screaming things quite unintelligable but -- most
curiously -- thick with a sumerian accent.)

"The comedy is over" -i pagliacci


Post a reply to this message

From: John VanSickle
Subject: Re: Automatic copyright text - need math help
Date: 11 Oct 1998 16:11:24
Message: <36210ACC.159854D7@erols.kosher.com>
Lewis Sellers wrote:
> 
> John VanSickle wrote:
> >
> > Hope this helps,
> > John
> 
> Works nicely in fact.
> 
> I had no idea there was a "matrix" keyword until I saw it there. Not
> that I would have known what to do with it though. But, I learned
> something new today. :)

Well, when a problem calls for a matrix I usually pop out of the
woodwork...

> You should make it a standard .inc file if you haven't already.

I would, except that the camera definition is an important part of the
code, which means it's not a good candidate for .INC file status.

Regards,
John

-- 
"He has the power to rear-project major cities!" -- Mike Nelson


Post a reply to this message

From: Lewis Sellers
Subject: Re: Automatic copyright text - need math help
Date: 11 Oct 1998 20:31:49
Message: <36214000.436BEF16@usit.net>
John VanSickle wrote:
> > You should make it a standard .inc file if you haven't already.
> 
> I would, except that the camera definition is an important part of the
> code, which means it's not a good candidate for .INC file status.
> 

I take it that povray isn't object oriented and you can just read those
things with povray.camera.look_at ? :)
Oh well...


-- 
Lewis A. Sellers: writer and contract Multimedia Website Developer
mailto:lse### [at] usitnet (The Fourth Millennium Foundation)
http://www.public.usit.net/lsellers/ & http://www.intrafoundation.com
http://brain-of-pooh.tech-soft.com/users/critters/bios/sellers_lewis.html

You can bug the living bejesus out of me live on ICQ @ 491461
(If I don't get back to you within a month, I'm out of prozac in some
dark corner somewhere screaming things quite unintelligable but -- most
curiously -- thick with a sumerian accent.)

"The comedy is over" -i pagliacci


Post a reply to this message

From: John VanSickle
Subject: Re: Automatic copyright text - need math help
Date: 15 Oct 1998 19:01:54
Message: <36267800.6F6AAC75@erols.com>
Lewis Sellers wrote:
> 
> John VanSickle wrote:
> > > You should make it a standard .inc file if you haven't already.
> >
> > I would, except that the camera definition is an important part of the
> > code, which means it's not a good candidate for .INC file status.
> >
> 
> I take it that povray isn't object oriented and you can just read those
> things with povray.camera.look_at ? :)
> Oh well...

No, at least not yet.

-- 
"Have the manners not to be hittin' the man until he's your husband, and
entitled to hit back!"


Post a reply to this message

From: Nathan Kopp
Subject: Re: Automatic copyright text - need math help
Date: 16 Oct 1998 12:21:47
Message: <3627644F.A02E0B5C@ltu.edu>
John:

This is great code!!! I'm just now taking a class in linear algebra, so this
really makes sense to me and I've adopted it into my lens flare include file.
I would make one change, though.  In the line that reads:

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

I would change "y" to the sky vector (the default happens to by "y").
This way, you can use it with scenes from Moray (which uses "z" as the sky
vector) and also with scenes that roll the camera.

-Nathan

John VanSickle wrote:
> 
> Lewis Sellers wrote:
> >
> > Well, I was trying to do this myself, but my math is so weak it'll take
> > me forever.... :)
> >
> > Ok. I was trying to make it so that the small text "Copyright 1998 by
> > Lewis Sellers" would automatically be placed in the bottom left of any
> > scene I rendered no matter the camera positions. Very handy in
> > animations, etc.
> 
> #local CamE = <0,0,0>; //where the camera's look_at is
> #local CamL = <10,12,1>; //where the camera's location is
> #local CamZ = 2; //the amount of camera zoom you want
> 
> #local CamD = vnormalize(CamE-CamL);
> #local CamR = vnormalize(vcross(y,CamD));
> #local CamU = vnormalize(vcross(CamD,CamR));
> 
> text { ttf "cyrvetic.ttf","(c) 1998 by Lewis Sellers",.01,0
>   texture { YourTexture }
>   scale .1
>   translate <-.65,-.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
> }
> 
> Hope this helps,
> John
> 
> --
> "He has the power to rear-project major cities!" -- Mike Nelson


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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