POV-Ray : Newsgroups : povray.programming : Photovista 360 panoramas of POV scenes : Re: Photovista 360 panoramas of POV scenes Server Time
29 Jul 2024 02:34:22 EDT (-0400)
  Re: Photovista 360 panoramas of POV scenes  
From: Mike
Date: 18 Dec 1998 17:43:19
Message: <367B7516.55004222@aol.com>
There was some discussion on this that I started here a little while
back.  Chris Colefax posted a method for creating these views using a
panoramic camera and later I posted a simple patch for doing it with one
render.

Here's a repost:

Unfortunately, the camera does not properly render angles over 180
degrees (possibly the same bug as Roland pointed out with the
ultra_wide_angle?).  This problem can be quite easily overcome by first
rendering the image with the desired camera:

   camera {location <0, 0, 0> look_at <0, 0, 1>
      right x up y panoramic angle 180}

at a 1:1 ratio, and then rotating the camera by y*180 and rendering to a
second image of the same size.  When the two images are combined
side-by-side you should have the perfect image_map for a sphere.  In
fact, I tried mapping an quick test scene to a semitransparent sphere in
front of the original scene, and all objects seemed to correlate very
well, with no distortion (even at the poles).

And here's the patch I came up with a few days later.  I've wanted to go
back and make it work better, but I haven't had the time to spend on it:

While I had noticed that I could get half of the spherical projection
this way, that was long before I had stared at the code for hours and
hours.  I decided to go back and look at the code and found that I could
get a full 360 view by simply changing x0 to go from 0 to 2 instead of 0
to 1.  Here's the code for anyone interested in trying it out:

   case TEST_CAMERA_1:

/* Convert the x coordinate to be a DBL from 0.0 to 2.0. */ //changed
from 0.0 to 1.0

      x0 = 2 * x / (DBL)Frame.Screen_Width;

      /* 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 cylindrical coordinates. */

      x0 = (1.0 - x0) * M_PI;

      y0 = M_PI_2 * y0;

      cx = cos(x0);
      sx = sin(x0);

      if (fabs(M_PI_2 - fabs(y0)) < EPSILON)
      {
        if (y0 > 0.0)
        {
          ty = BOUND_HUGE;
        }
        else
        {
          ty = - BOUND_HUGE;
        }
      }
      else
      {
        ty = tan(y0);
      }

      /* Create primary ray. */

      VLinComb3(Ray->Direction, cx, FCR, ty, FCU, sx, FCD);

      initialize_ray_container_state(Ray, Precompute_Camera_Constants);

      Precompute_Camera_Constants = FALSE;

      break;

If rendered with the following camera, the resulting image can be mapped
onto a sphere to recreate the scene.  There does appear to be a slight
amount of distortion, but that may be due to the scene I was rendering.
The top and bottom will be seamless.

camera {
test_camera_1
location <0, 0, 0> look_at <0, 0, 1>
right x
up y
angle 180
}

A 2:1 aspect ratio should be used for the image, so a 1000 pixel wide
image should be 500 pixels in height.  I'm sure this was an odd
workaround and that the code could be changed to work with an angle of
360, but I'm just happy to have found a solution. ;-)

-Mike


Steve Smith wrote:
> 
> Im using the Photovista 360 panorama applet to view  ray traced scenes.
> The results are quite good, they do give a very immersive effect (you
> can see the the result at
> http://www.pavan.co.uk/pavanvrml.html ).
> 
> My problem is....
> 
> I'm using povray animation to produce 4 views with 90 angles and
> stitching them together to make a panorama. Photovista then requires me
> to define the camera focal length.
> Can anyone give me a povray camera definition which would correspond to
> an 18mm camera? (better still a general formula)
> 
> Also, it possible to define a single 360 view? The panoramic camera
> always seems to result in a view of about 180 degrees
> 
> Thanks in advance.
> 
> --
> -------------------------------------------------------------------------
> 
> Steve Smith
> Rhiwlan, Penrhyncoch, Aberystwyth, Ceredigion, SY23 3EH, Wales
> Tel: 01970 820750
> Email: ste### [at] pavancouk
> http://www.pavan.co.uk


Post a reply to this message

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