POV-Ray : Newsgroups : povray.newusers : offaxis fisheye camera : Re: offaxis fisheye camera Server Time
19 Apr 2024 18:01:35 EDT (-0400)
  Re: offaxis fisheye camera  
From: CAD-Andi
Date: 26 Feb 2008 15:30:00
Message: <web.47c4767f557e8a52b62362f80@news.povray.org>
"CAD-Andi" <nomail@nomail> wrote:
> Hi all!
>
> I'm investigating Paul Bourke's approach to project povray generated images onto
> a dome screen.
> I found the source code for his implementation of an "offaxis fisheye camera"
> for povray.
> (See: http://ozviz.wasp.uwa.edu.au/~pbourke/modelling_rendering/povcameras/).
> I'm not a full blown programmer and don't know much about compiling. I'm
> working with MegaPOV and Povray for Windows 2000 and also Povray for OSX. Can
> anyone help?

This is the source code that Paul came up with.

   /*
       pdb - Offset fisheye for planetariums with a shifted sweet spot.
       Essentially just translates the view vector in the plane of the
hemisphere.
    */
    case OFFSETFISHEYE_CAMERA:

      // Normalised coodinates
      x0 = 2.0 * x / (DBL)Frame.Screen_Width - 1.0;
      y0 = 2.0 * ((DBL)(Frame.Screen_Height - 1) - y) / (DBL)Frame.Screen_Height
- 1.0;

      // If the pixel lies outside the unit circle no ray is traced.
      if ((rad = sqrt(x0 * x0 + y0 * y0)) > 1.0)
        return(false);

      // Fisheye polar coordinates
      theta = atan2(y0,x0); // -pi .. pi
      phi = 0.5 * rad * Frame.Camera->Angle * M_PI_180;  // 0 .. aperture/2

      // My own unit vector versions
      VNormalize(vd,Frame.Camera->Direction);
      VNormalize(vr,Frame.Camera->Right);
      VNormalize(vu,Frame.Camera->Up);

      V1[0] = sin(phi)*cos(theta) - Frame.Camera->Fish_XOffset;
      V1[1] = sin(phi)*sin(theta) - Frame.Camera->Fish_YOffset;
      V1[2] = cos(phi);
      VLinComb3(Ray->Direction,V1[0],vr,V1[1],vu,V1[2],vd);

      initialize_ray_container_state(Ray, true);
      break;


I can't compile this myself. Is there any other solution that makes it possible
to create off-axis fisheye projection?


Post a reply to this message

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