POV-Ray : Newsgroups : povray.general : Camera Parameters, esp. angle : Camera Parameters, esp. angle Server Time
5 Aug 2024 18:19:29 EDT (-0400)
  Camera Parameters, esp. angle  
From: Ichthyostega
Date: 5 Aug 2002 10:50:18
Message: <web.3d4e8f5c1bebab9972f2eb850@news.povray.org>
Recently, in Thread "Questions about panoramic cameras and other stuff."
Mike brought up the question how the different camera modifiers
are now handled, especially "angle" in panoramic camera.

There were some annoying bugs in POV 3.1 regarding the aspect ratio
e.g. with fisheye. It was known that there where changes to the
camera definition in POV 3.5

Now, that the source code was released (THANKS!), I yesterday took
the oppertunity to look up the relevant sections to see, what the
current status is and what is the case with the problems, Mike
reported


First, I want to quote a coment they put where parsing the camera,
because it makes very clear what's going on:

/*
 * The camera statement in version 3.5 is a tiny bit more restrictive
 * than in previous versions (Note: Backward compatibility is available
 * with the version switch!).  It will always apply camera modifiers in
 * the same order, regardless of the order in which they appeared in the
 * camera statement.  The order is as follows:
 *
 * right
 * direction
 * angle (depends on right, changes direction-length)
 * up
 * sky
 * location
 * look_at (depends on location, right, direction, up, sky,
 *          changes right, up, direction)
 * focal_point (depends on location)
 *
 * VERIFY: Is there a need to modify look_at to consider angle, right, up
 *         and/or direction??? [trf]
 * VERIFY: Is there a need to modify angle to consider direction??? [trf]
 */


With this, all parameters now have a clear precedence.
The only parameter that remains a bit confusing is the "angle":

1) for perspective and orthographic camera, "angle" is a "convienience
   shortcut" (my term), i.e. it adjusts the focal length (direction vector).
2) Because the length of the direction vector is of no importance for
   orthograpic camera, it makes an additional adjustment (after aplying
   "look_at"), in order to get a similar image area as with the perspective
   camera.
3) For all other camera types, "angle" is a primary or basic parameter, i.e.
   it is passed on to the renderer and directly used when creating rays.
   Fisheye and ultra_wide_angle are now fixed and work fine.
   But:
3a) Panoramic camera *doesn't use the angle at all*, it simply ignores the
    setting and allways shows 180deg in both directions. This is also
    bad for the aspect ratio
3b) the cylinder cameras (1 and 3) use the angle correctly in horizontal
    direction, but use the length of the "up" vector in vertical direction
    as a scale factor. They ignore the length of the "right" vector.
    This is bad for the aspect ratio, because you have to do some math
    manually in order to avoid distortions (set the length of the "up"
    vector to match the circumference of a unit cylinder for the given
angle)
    Of course, cylinder cameras 2 and 4 behave analogous, but with the roles
    of "up" and "right" exchanged.

The panoramic camera, over all, seems to be a bit strange. I would
be interested, if there is anyone who uses and likes this camera.

Personally, I prefer the cylinder cameras, because they behave like a
real world photographic panorama camera. But I find 3b) very anoying
whould propose the following fix:
(This fix is testd; my StereoPOV-Patch alredy containes this fix for
 my stereoscopic cylinder camera)


POV-Ray 3.5 does the following:

---pseudo-code-----------------------------------------------------

        lx = Length(RIGHT);
        ly = Length(UP);

        Camera_Aspect_Ratio = ly; /* not the usual aspect ratio */

        VNormalize(FCR, FCR);
        VNormalize(FCU, FCU);
        VNormalize(FCD, FCD);

      x0 *= Camera_Angle * PI / 180;
      y0 *= Camera_Aspect_Ratio;

      /* Create primary ray based on the parameters x0 and y0 */

--/pseudo-code-----------------------------------------------------


I would propose:

---pseudo-code-----------------------------------------------------

        lx = Length(RIGHT);
        ly = Length(UP);

        Camera_Aspect_Ratio = ly / lx;

        VNormalize(FCR, FCR);
        VNormalize(FCU, FCU);
        VNormalize(FCD, FCD);

      x0 *= Camera_Angle * PI / 180;
      y0 *= Camera_Angle * PI / 180  * Camera_Aspect_Ratio;

      /* Create primary ray based on the parameters x0 and y0 */

--/pseudo-code-----------------------------------------------------


This, I think is what the user expects if she sets an "angle":
Image shows this angle (in horizontal direction) and the
aspect ratio is retained.



Hermann Vosseler


Post a reply to this message

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