 |
 |
|
 |
|
 |
|  |
|  |
|
 |
From: Alexander Jolk
Subject: povray 3.1 bug: panoramic camera ignores `angle'
Date: 19 Mar 2001 06:17:27
Message: <3ab5eac7@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Hi,
I discovered that the panoramic camera of povray 3.1g (Linux) completely
ignores any specified camera `angle'. I'm actually not quite clear on
how this was supposed to work, but I propose the following patch:
---8<---
diff -ur povray31-orig/source/render.c povray31/source/render.c
--- povray31-orig/source/render.c Sat May 1 15:01:28 1999
+++ povray31/source/render.c Thu Mar 15 00:51:22 2001
@@ -2841,19 +2841,33 @@
case PANORAMIC_CAMERA:
- /* Convert the x coordinate to be a DBL from 0.0 to 1.0. */
+ /* Convert the x coordinate to be a DBL from -0.5 to 0.5. */
- x0 = x / (DBL)Frame.Screen_Width;
+ x0 = x / (DBL)(Frame.Screen_Width - 1) - 0.5;
/* Convert the y coordinate to be a DBL from -1.0 to 1.0. */
y0 = 2.0 * ((DBL)(Frame.Screen_Height - 1) - y) /
(DBL)Frame.Screen_Height - 1.0;
+ /* Get aspect ratio (do this only once). */
+
+ if (Precompute_Camera_Constants)
+ {
+ VLength(lx, FCR);
+ VLength(ly, FCU);
+
+ Camera_Aspect_Ratio = lx / ly;
+
+ VNormalize(FCR, FCR);
+ VNormalize(FCU, FCU);
+ VNormalize(FCD, FCD);
+ }
+
/* Get cylindrical coordinates. */
- x0 = (1.0 - x0) * M_PI;
+ x0 = x0 * M_PI_180 * Frame.Camera->Angle;
- y0 = M_PI_2 * y0;
+ y0 = y0 * M_PI_360 * Frame.Camera->Angle / Camera_Aspect_Ratio;
cx = cos(x0);
sx = sin(x0);
@@ -2876,7 +2890,7 @@
/* Create primary ray. */
- VLinComb3(Ray->Direction, cx, FCR, ty, FCU, sx, FCD);
+ VLinComb3(Ray->Direction, sx, FCR, ty, FCU, cx, FCD);
initialize_ray_container_state(Ray, Precompute_Camera_Constants);
--->8---
The behaviour is now as follows: `angle' gives the horizontal viewing
angle, with -angle/2 relative to the look_at direction at the left
border of the image and +angle/2 at the right border. The total
vertical viewing angle is given by angle * the image aspect ratio
length(up)/length(right), again with zero at the image center.
I'm using the thusly patched version to create 360-degree panoramic
views that can be displayed using the freely available PTViewer
application, which allows you to pan around in the image as if you
were turning the camera. Makes a great new toy :-)
Alex
--
Alexander Jolk * Ale### [at] phys uni-karlsruhe de * +49-721-608-3572
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Warp
Subject: Re: povray 3.1 bug: panoramic camera ignores `angle'
Date: 19 Mar 2001 06:36:44
Message: <3ab5ef4b@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Try putting the 'angle' earlier in the camera block.
--
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Fabien Mosen
Subject: Re: povray 3.1 bug: panoramic camera ignores `angle'
Date: 19 Mar 2001 07:15:55
Message: <3AB5F7E5.26112212@skynet.be>
|
|
 |
|  |
|  |
|
 |
Warp wrote:
>
> Try putting the 'angle' earlier in the camera block.
Where ? When I put the angle before the projection type, it says
that angle must be smaller than 180. Can you give a working
example ?
Fabien.
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Warp
Subject: Re: povray 3.1 bug: panoramic camera ignores `angle'
Date: 19 Mar 2001 07:25:26
Message: <3ab5fab6@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Fabien Mosen <fab### [at] skynet be> wrote:
: Where ? When I put the angle before the projection type, it says
: that angle must be smaller than 180. Can you give a working
: example ?
I think that there's a limitation of 180 degrees for panoramic camera.
An odd and probably buggy limitation which will probably be fixed, but
it is there.
--
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Fabien Mosen
Subject: Re: povray 3.1 bug: panoramic camera ignores `angle'
Date: 19 Mar 2001 11:57:53
Message: <3AB639FA.BA1DF7DA@skynet.be>
|
|
 |
|  |
|  |
|
 |
Well, there's a temporary fix, rendering two face-to-face 180 degrees
BTW, it's all fun. Only problem is that most of my existing scenes
are totally empy *behind* the camera ! duh !
Also, only 'real' raytracers can do that ! niark niark niark...
Fabien.
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Alexander Jolk
Subject: Re: povray 3.1 bug: panoramic camera ignores `angle'
Date: 20 Mar 2001 05:40:28
Message: <3ab7339c@news.povray.org>
|
|
 |
|  |
|  |
|
 |
>Well, there's a temporary fix, rendering two face-to-face 180 degrees
Well, sorry, no: the existing camera does 180 deg only left-to-right,
and only 90deg vertically. And you cannot just stitch four of them
together for a panoramic viewer, due to the distortions at the picture
borders.
Alex
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Fabien Mosen
Subject: Re: povray 3.1 bug: panoramic camera ignores `angle'
Date: 20 Mar 2001 06:20:04
Message: <3AB73C4B.8F453130@skynet.be>
|
|
 |
|  |
|  |
|
 |
Ale### [at] physik uni-karlsruhe de wrote:
>
> >Well, there's a temporary fix, rendering two face-to-face 180 degrees
>
> Well, sorry, no: the existing camera does 180 deg only left-to-right,
> and only 90deg vertically. And you cannot just stitch four of them
> together for a panoramic viewer, due to the distortions at the picture
> borders.
It's not perfect, as it produces distortions on top and bottom
(but you have to look very straight up or down), but it works rather
well anyway. However, the fix is welcome. Hope the next
MegaClothMan++8.241StuffPatch will carry it.
The main problem, as I said, is to find suitable scenes. After 7 years
of POV-Ray, I only got 2 or 3 of these...
Fabien.
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Jonathan Hunt
Subject: Re: povray 3.1 bug: panoramic camera ignores `angle'
Date: 20 Mar 2001 13:37:01
Message: <3ab7a34d@news.povray.org>
|
|
 |
|  |
|  |
|
 |
> > Well, there's a temporary fix, rendering two face-to-face 180 degrees
>
> Well, sorry, no: the existing camera does 180 deg only left-to-right,
> and only 90deg vertically. And you cannot just stitch four of them
> together for a panoramic viewer, due to the distortions at the picture
> borders.
Try using a fisheye camera set to 360 degrees, and use Helmut Dersch's
panorama tools... http://www.fh-furtwangen.de/~dersch/ ...to do the
conversion to equirectangular projection.
Worked well for me. See some examples below...
Alien Island...
http://www.xlcus.co.uk/povray/island/pan.html
Julia...
http://www.xlcus.co.uk/povray/julia/pan.html
Cheers,
--
Jonathan Hunt
http://www.xlcus.co.uk/povray/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |