POV-Ray : Newsgroups : povray.general : Camera Parameters, esp. angle Server Time
18 Nov 2024 15:24:02 EST (-0500)
  Camera Parameters, esp. angle (Message 1 to 10 of 10)  
From: Ichthyostega
Subject: Camera Parameters, esp. angle
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

From: Mike
Subject: Re: Camera Parameters, esp. angle
Date: 5 Aug 2002 17:45:11
Message: <web.3d4ef0daa27e73858b0b6f760@news.povray.org>
Like I mentioned in the other thread, panoramic cameras behaved this way in
3.1 as well. I wonder if this was overlooked in the source, or whether it
is intended to work that way, in which case the docs should be updated to
reflect the fact that angle has no effect on the panoramic camera type.

Heh, I always though it was just me. No one ever noticed this before? I'm
surprised. I guess I can feel like I've contributed now. :)


Post a reply to this message

From: Ichthyostega
Subject: Re: Camera Parameters, esp. angle
Date: 6 Aug 2002 04:55:14
Message: <web.3d4f8defa27e738572f2eb850@news.povray.org>
Mike wrote:
>Like I mentioned in the other thread, panoramic cameras behaved this way in
>3.1 as well. I wonder if this was overlooked in the source, or whether it
>is intended to work that way, in which case the docs should be updated to
>reflect the fact that angle has no effect on the panoramic camera type.
>
>Heh, I always though it was just me. No one ever noticed this before? I'm
>surprised. I guess I can feel like I've contributed now. :)
>

Sometimes, I got the impression, panoramic cameras are a rather exotic
feature, used sadly enough only to get "distorted images". In this case
it doesn't matter when the aspect ratio is wrong or the angele doesn't fit.

Or, maybee, everyone uses the Cylinder Cameras, and so panoramic
camera is rather redundant and thus no one noticed, that angle
on panoramic camera doesn't work?

But, btw, anyone who got across problems with aspect ratio using
the cylinder cameras? (Or am I the only one who is annoyed by
the current behaviour)


Hermann


Post a reply to this message

From: Mike
Subject: Re: Camera Parameters, esp. angle
Date: 6 Aug 2002 11:45:23
Message: <web.3d4fee6fa27e738523878ff90@news.povray.org>
Ichthyostega wrote:
>But, btw, anyone who got across problems with aspect ratio using
>the cylinder cameras? (Or am I the only one who is annoyed by
>the current behaviour)

I honestly can't tell what a cylinder camera is 'supposed' to look like, so
I have no idea. I wish I could find a diagram explaining the way the
projection is supposed to work.

Incidentally, you mentioned in the orthographic camera's second mode it uses
angle to get the same view as a perspective camera. What is the extra
calculation it makes and what value(s) does it change? Just curious.


Post a reply to this message

From: Mike
Subject: Re: Camera Parameters, esp. angle
Date: 6 Aug 2002 12:25:10
Message: <web.3d4ff7f5a27e738523878ff90@news.povray.org>
OK I looked at the source again and I found where the change is made. It
scales the up and right vectors, but I don't understand exactly by what
values.
What is k1/k2 equal to?

Here's the section of POV's code:

if (((had_up == false) && (had_right == false)) || (had_angle == true))
   {
    // resize right and up vector to get the same image
    // area as we get with the perspective camera
    VSub(tempv, New->Look_At, New->Location);
    VLength(k1, tempv);
    VLength(k2, New->Direction);
    if ((k1 > EPSILON) && (k2 > EPSILON))
    {
     VScaleEq(New->Right, k1 / k2);
     VScaleEq(New->Up, k1 / k2);
    }
   }


Post a reply to this message

From: Ron Parker
Subject: Re: Camera Parameters, esp. angle
Date: 7 Aug 2002 10:42:09
Message: <slrnal2ce6.7fm.ron.parker@fwi.com>
On Tue,  6 Aug 2002 04:50:55 EDT, Ichthyostega wrote:
> Sometimes, I got the impression, panoramic cameras are a rather exotic
> feature, used sadly enough only to get "distorted images". In this case
> it doesn't matter when the aspect ratio is wrong or the angele doesn't fit.

Panoramic cameras have a fixed angle because that's the way they were made.
They always render a hemisphere.  I'm not sure how you can say the aspect
ratio is wrong; it's just a matter of understanding that "aspect ratio" 
is meaningless when your pixels are measured in degrees instead of inches,
because the distance in inches across the center of the image will always
be infinitely larger than the distance in inches across the top of the image.

"panoramic" is like half of a Mercator projection, but without the correction
factor that keeps Greenland from being "squished" vertically.

I think you'll find that the effects you're looking for are easier to
achieve with the ultra_wide_angle camera type rather than the panoramic.

-- 
#local R=rgb 99;#local P=R-R;#local F=pigment{gradient x}box{0,1pigment{gradient
y pigment_map{[.5F pigment_map{[.3R][.3F color_map{[.15red 99][.15P]}rotate z*45
translate x]}]#local H=pigment{gradient y color_map{[.5P][.5R]}scale 1/3}[.5F
pigment_map{[.3R][.3H][.7H][.7R]}]}}}camera{location.5-3*z}//only my opinions


Post a reply to this message

From: Ichthyostega
Subject: Re: Camera Parameters, esp. angle
Date: 7 Aug 2002 12:50:05
Message: <web.3d514ee9a27e738572f2eb850@news.povray.org>
Ron Parker wrote:
>Panoramic cameras have a fixed angle because that's the way they were made.
>They always render a hemisphere.  I'm not sure how you can say the aspect
>ratio is wrong; it's just a matter of understanding that "aspect ratio"
>is meaningless when your pixels are measured in degrees instead of inches,
>because the distance in inches across the center of the image will always
>be infinitely larger than the distance in inches across the top of the image.
>
>"panoramic" is like half of a Mercator projection, but without the correction
>factor that keeps Greenland from being "squished" vertically.
>
>I think you'll find that the effects you're looking for are easier to
>achieve with the ultra_wide_angle camera type rather than the panoramic.
>

I must confess, I was a bit fuzzy with the term "panoramic" in my
recent posts. I judged the images povray renders by comparision with real
world (photographic) panoraic cameras. Those cameras often have a fixed
angle, e.g. 140deg, 180deg, 360deg. But there is no reasonable limitation
in the formula used to create the image that would dictate a fixed angle of
180deg.
(Of course, we can't go byond 180deg in vertical direction).

With "cylinder 1" camera (perspective projection in vertical, panoramic
in horizontal direction) you can achieve similar results to photograpic
cameras. But sometimes the Mercator projection would yield better looking
results, if there was a way to better controll the working of POV-Ray's
panoramic camera. As a user, I see no reason why I should not render a
image covering 240deg horizontal and 60deg vertical angle.

With regard to the aspect ratio, you are right if we relate the "aspect
ratio" to image angle covered by a given pixel. But on the other hand,
the image is created by projection on a unit cylinder. We can wrap the
image off this cylinder to a flat rectangle, and the aspect ratio of
this rectangle can be judged.

Thus, in my first post, I proposed to modify the handling of the angle
parameter in a way to ensure, the final image wraped off the cylinder
sticks to the aspect ratio set by "up" and "right" vector.

Hermann Vosseler


Post a reply to this message

From: Ichthyostega
Subject: Re: Camera Parameters, esp. angle
Date: 7 Aug 2002 13:05:20
Message: <web.3d515223a27e738572f2eb850@news.povray.org>
Mike wrote:
>OK I looked at the source again and I found where the change is made. It
>scales the up and right vectors, but I don't understand exactly by what
>values.
>What is k1/k2 equal to?

I would guess, the idea is to make the comparision between perspective
and orthographic camera in the image plane. If a perspective camera
has a greater focal length (direction vector), it coveres the area given
by "up" and "right" *in its image plane* (which is located at a distance
given by the distance vector).
At unit distance (where the area covered by the orthographic camera
is defined), the given perspective camera with greater focal length
will cover a smaller area, as given by up*k1/k2 and right*k1/k2
where
   up = length("up")
   right= length("right")
   k1 = length("look_at")
   k2 = length("direction")

IIRC, the "look_at" vector is normalized somewhere beforhand.

Did I express myself clear???

Hermann


Post a reply to this message

From: Mike
Subject: Re: Camera Parameters, esp. angle
Date: 7 Aug 2002 13:25:15
Message: <web.3d515797a27e738523878ff90@news.povray.org>
Ron Parker wrote:
>Panoramic cameras have a fixed angle because that's the way they were made.

Then the documentation is in error.
It states that the angle keyword can be used with the panoramic camera type.
If instead, the documentation is correct, then the source code is wrong.

One of them should be fixed.  :)


Post a reply to this message

From: Mike
Subject: Re: Camera Parameters, esp. angle
Date: 7 Aug 2002 13:30:17
Message: <web.3d515823a27e738523878ff90@news.povray.org>
Ichthyostega wrote:
>Did I express myself clear???

Yes, thanks.


Post a reply to this message

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