POV-Ray : Newsgroups : povray.animations : Calculating pixel rates : Re: Calculating pixel rates Server Time
5 May 2024 02:13:05 EDT (-0400)
  Re: Calculating pixel rates  
From: clipka
Date: 26 Feb 2009 16:15:01
Message: <web.49a7062176dd3071919973e90@news.povray.org>
"RC" <nomail@nomail> wrote:
> My understanding is
> that my clock values are equal divisions of my final frame value,

Yes, that is right.

> so with that
> in mind if I have a 720 or 1920 pixel wide image rendering and I want to move
> my object one pixel/frame, then all I would need to do is make my final frame
> equal to the pixel width and use my clock value as my one pixel/frame motion
> value.
>                  translate <clock,0,0>

Actually this is the wrong math already. It only holds true if your camera
happens to be 1.0 POV units away from the object's trajectory with an opening
angle of 90 degrees - or a suitable other distance if the opening angle is
different.

> BUT, what if I am not exactly <0,0,0> in my camera position, and view? How can I
> calculate how much my clock is moving an object? Are there any other ways to do
> this?

Simple advice: Try to get away from pixel-based thinking. It's almost never the
natural units to work with in POV, and it's incompatible with changes of the
image resolution.

As for the math: With the most common camera settings

  camera {
    perspective
    location  MyCameraLocation
    right     x*image_width/image_height
    up        y
    direction z
    look_at   MyObjectLocation
    angle     MyCameraAngle
  }

you can convert from POV units and vice versa using the following formulae (see
diagram in section 3.3.1.1 "Placing the Camera" of POV's online help):

  (1) tan(MyCameraAngle/2) * unitDistance = 0.5
  or  unitDistance = 0.5 / tan(MyCameraAngle/2)

  (2) pixels / image_width = size / (distance/unitDistance)
  or  pixels = image_width * size / (distance/unitDistance)
  or  size = (pixels/image_width) * (distance/unitDistance)

Formula (1) describes the distance at which 1 POV unit will appear to be equal
to the image width, while (2) describes the relation between size in pixels and
size in POV units.


Post a reply to this message

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