POV-Ray : Newsgroups : povray.general : Camera distance calculation Server Time
1 Aug 2024 18:22:29 EDT (-0400)
  Camera distance calculation (Message 1 to 7 of 7)  
From: Sigma
Subject: Camera distance calculation
Date: 23 May 2005 21:25:01
Message: <web.4292821d79d34bc9711f65090@news.povray.org>
Is there some sort of flag that allows cameras to computer distance using
the distance eqation (Sqrt(x^2+y^2+z^2))?  This would be nice to turn for
some camera types.  I know fish eye lens appears gives something similar,
however, I don't feel like cutting out rectangular shapes to make a square
image.


Post a reply to this message

From: Rune
Subject: Re: Camera distance calculation
Date: 24 May 2005 03:08:22
Message: <4292d2e6@news.povray.org>
Sigma wrote:
> I know fish eye lens appears gives something similar,
> however, I don't feel like cutting out rectangular
> shapes to make a square image.

camera {fisheye up y/2 right x*4/3/2}

Rune
-- 
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

From: Sigma
Subject: Re: Camera distance calculation
Date: 24 May 2005 05:15:00
Message: <web.4292f061ccb775db711f65090@news.povray.org>
Hey thanks...

I've started looking into transformations which I hope would replace the
default depth with the proper equation.  Because I don't know if fisheye
(which works well for many things) is technically correct, even though it
looks like it.  Also the view is less than the actual angle specified (but
that most fixable).  I've just started looking at the transformations
today, but I figure there must be a way to change the z values used to
divide for depth (Would I need to modify Xz, Yz, and Zz?)


Post a reply to this message

From: Slime
Subject: Re: Camera distance calculation
Date: 24 May 2005 15:27:04
Message: <42938008@news.povray.org>
> Is there some sort of flag that allows cameras to computer distance using
> the distance eqation (Sqrt(x^2+y^2+z^2))?

POV-Ray's camera code doesn't compute distance anywhere; and if it did, I'm
sure it would use that equation anyway. What is it that you're trying to
change?

> I know fish eye lens appears gives something similar

Similar to what?

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Sigma
Subject: Re: Camera distance calculation
Date: 24 May 2005 18:10:01
Message: <web.4293a60eccb775db711f65090@news.povray.org>
> POV-Ray's camera code doesn't compute distance anywhere; and if it did, I'm
> sure it would use that equation anyway. What is it that you're trying to
> change?
>
> > I know fish eye lens appears gives something similar
>
> Similar to what?
>
>  - Slime
>  [ http://www.slimeland.com/ ]

I guess I mean the z value.  I wrote a custom rendered for the winamp's AVS
(yes I know thats horrible) that divided by true distance instead of just
z...  However that was very long ago and I cannot remember how to set up
the matrix the same.  More or less, it would make things based on the x and
y off set smaller based on the fov.

Two cases:
1:  point 3,3,3; camera is at 0,0,0; looking at 3,3,3.  The x and y will be
at the center of the camera's fov, and will not be affected.  (z = 3,
unless I'm not thinking clearly right now)

2:  same point and camera point, but looking at 0,3,3 (assuming angle >=90)
will rendered differently if z is replaced.  A traditional camera says the
distance to that point (based on z alone) would be something like 3/sqrt(2)
appox. 2.1.  With the true distance calculation, it would be Sqrt((
3/sqrt(2) )^2 + 0^2 + ( 3/sqrt(2) )^2 ) = 3.  (I drew a diagram quickly to
check my work, and I figure I should have used a scale of 1, not 3).

I am not sure if I made my self clear, but generally I want the depth to be
distance, not the fast linear approximation of distance (which works great
for lower fovs).  When x and y are small (low fov or near center of fov),
the equation can be writen as Sqrt(z^2) = z, which is what the camera
divides by default.  The fish eye lens generates something that looks like
it could be correct, but I don't know if it is correct
mathematically/physically.


Post a reply to this message

From: Slime
Subject: Re: Camera distance calculation
Date: 24 May 2005 20:21:18
Message: <4293c4fe$1@news.povray.org>
> I guess I mean the z value.  I wrote a custom rendered for the winamp's
AVS
> (yes I know thats horrible) that divided by true distance instead of just
> z...  However that was very long ago and I cannot remember how to set up
> the matrix the same.  More or less, it would make things based on the x
and
> y off set smaller based on the fov.

Oookay. You're kind of thinking of the scanline sort of algorithm where, for
every point of importance (such as a triangle vertex), the x and y values
are divided by the z value to get the position on screen.

Since POV-Ray is a raytracer, it works a little differently; that division
is never actually performed. Instead, the camera is defined as a mapping
from screen coordinates ((u,v) coordinates; the horizontal and vertical
position on the image) into 3D vectors (directions away from the camera
center). For each pixel in the image, that mapping is used to get the
direction in which a ray is shot into the scene, and the color the ray sees
is used for the color of the pixel.

The default perspective camera uses a mapping that creates the divide-by-z
effect that you're used to. It sounds like you want something where the
(u,v) coordinates are interpreted as angles from a central offset. Fisheye
does kind of do what you want, but it doesn't create rectangular images. I
think panoramic might do the trick, or maybe ultra_wide_angle. If all else
fails, I believe MegaPov (or maybe it was a different unofficial patch?) has
a feature where you can use functions to define the mapping mathematically,
so it should be possible to get the effect you want even if you have to code
it yourself.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Sigma
Subject: Re: Camera distance calculation
Date: 24 May 2005 23:25:01
Message: <web.4293ef75ccb775db711f65090@news.povray.org>
Thanks


Post a reply to this message

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