POV-Ray : Newsgroups : povray.advanced-users : Pixel coords? Server Time
29 Jul 2024 10:18:00 EDT (-0400)
  Pixel coords? (Message 1 to 5 of 5)  
From: Hugo
Subject: Pixel coords?
Date: 2 Sep 2002 08:25:01
Message: <3d73589d@news.povray.org>
Hello,

I'd like to use POV as a kind of 2d animator. In other words, I load some
image_maps and move them around the screen. But for this to work reasonably,
I need a way to calculate the exact step in POV units between each pixel on
screen. This should be possible since Z is always zero, and I use an
orthographic camera.

But how?

Thanks!
Hugo


Post a reply to this message

From: Christoph Hormann
Subject: Re: Pixel coords?
Date: 2 Sep 2002 08:30:31
Message: <3D7359E5.DA4BB927@gmx.de>
Hugo wrote:
> 
> Hello,
> 
> I'd like to use POV as a kind of 2d animator. In other words, I load some
> image_maps and move them around the screen. But for this to work reasonably,
> I need a way to calculate the exact step in POV units between each pixel on
> screen. This should be possible since Z is always zero, and I use an
> orthographic camera.
> 
> But how?

You have the right and up vectors of the camera and the image_width and
image_height constants.  This should be enough to calculate the position.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Hugo
Subject: Re: Pixel coords?
Date: 2 Sep 2002 08:42:34
Message: <3d735cba@news.povray.org>
> You have the right and up vectors of the camera and the image_width
> and image_height constants.  This should be enough to calculate the
> position.

Thanks! I solved it with the "right" vector and I had to try different
angles.
Apparently this works:

camera {
   orthographic
   right 1*x
   location -1*z
   look_at 0
   angle 90
}

Thanks for the quick help.

Regards,
Hugo


Post a reply to this message

From: Pandora
Subject: Re: Pixel coords?
Date: 2 Sep 2002 09:32:01
Message: <3d736851@news.povray.org>
"Hugo" <hua### [at] post3teledk> wrote in message
news:3d735cba@news.povray.org...
> > You have the right and up vectors of the camera and the image_width
> > and image_height constants.  This should be enough to calculate the
> > position.
>
> Thanks! I solved it with the "right" vector and I had to try different
> angles.
> Apparently this works:
>
> camera {
>    orthographic
>    right 1*x
>    location -1*z
>    look_at 0
>    angle 90
> }
>


    Wouldn't you be better off with :

camera {
   orthographic
   right image_width*x
   up image_height*y
   location -1*z
   look_at 0
}

    then, you'll get a constant mapping of 1povunit=1pixel no matter what
the resolution you render at ?

(I haven't tested this, btw, so I could be wrong...)

--
Pandora/Scott Hill/[::O:M:C::]Scorpion
Software Engineer.
http://www.pandora-software.com


Post a reply to this message

From: Hugo
Subject: Re: Pixel coords?
Date: 2 Sep 2002 09:59:24
Message: <3d736ebc@news.povray.org>
> then, you'll get a constant mapping of 1povunit=1pixel no matter
> what the resolution you render at ?

Hmm, I didn't think of that.. Here's what I got with my camera statement:
The size of the visible area goes from -1 to +1 always.. When I load an
image that has a size of <106,135> and I want to scale it, I use this
variable:

#declare Pixels=2/<image_width,image_height,0>;
scale <106,135,1>*Pixels

Similar if I want to move it, by so many pixels... It's very easy.. Now,
that I finally got it to work. ;o)

Thanks,
Hugo


Post a reply to this message

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