POV-Ray : Newsgroups : povray.programming : spherical camera revisited Server Time
28 Jul 2024 18:25:59 EDT (-0400)
  spherical camera revisited (Message 1 to 6 of 6)  
From: Mike
Subject: spherical camera revisited
Date: 29 Jun 1999 19:55:46
Message: <37795B4D.D3EA5559@aol.com>
I posted an image binaries.images that was rendered with a new camera I
wrote.  While I'm here I'll let everyone in on how it works.

Basically you add the keyword spherical_camera and you can set the
vertical and horizontal field of view using v_angle and h_angle
repectively.  The camera renders as if the whole scene were projected on
a sphere in a reverse manner to how spherical_mapping works.  It can
also be thought of like the lattitude and longitude on a globe.

I used some of the matrix operations in matrices.c, so matrices.h needs
to be included in render.c.  Other than the camera, the rest is just
adding the new keywords and setting defaults for h_angle and v_angle
which are:

h_angle = 360, since this is longitude
v_angle = 180, since this is latitude

I was on-track for another way to do this, but I abandoned it for this
method because it's simple using the already present matrix functions
and it's also more decriptive this way.  Here's the new camera in
render.c:

/* MH 6/99
  * spherical camera: x is horizontal, y vertical
  * V_Angle - vertical FOV
     * H_Angle - horizontal FOV
  */

 case SPHERICAL_CAMERA:

      /* Convert the x coordinate to be a DBL from -0.5 to 0.5. */

      x0 = x / (DBL)Frame.Screen_Width - 0.5;

      /* Convert the y coordinate to be a DBL from -0.5 to 0.5. */

      y0 = ((DBL)(Frame.Screen_Height - 1) - y) /
(DBL)Frame.Screen_Height - 0.5;

      /* convert angle to radians */

      y0 *= (Frame.Camera->V_Angle / 360) * TWO_M_PI;

      x0 *= (Frame.Camera->H_Angle / 360) * TWO_M_PI;

       /* find direction of y on the virtual sphere */

   Compute_Axis_Rotation_Transform (&Trans, FCR, -y0);

   MTransPoint (V1, FCD, &Trans);

      /* Now take V1 and find direction of x at y */

   Compute_Axis_Rotation_Transform (&Trans, FCU, x0);

   /* Create primary ray. */

   MTransPoint (Ray->Direction, V1, &Trans);

   initialize_ray_container_state(Ray, Precompute_Camera_Constants);

      Precompute_Camera_Constants = FALSE;

      break;


Post a reply to this message

From: Robert Dawson
Subject: Re: spherical camera revisited
Date: 30 Jun 1999 16:07:20
Message: <377a78f8@news.povray.org>
While on the subject of Odd Cameras, here's my latest proposal that I don't
have time to code...free to a good home:

    "inverse" in the camera definition to mean that rays are traced inwards
from infinity. So you could see five sides of a cube... or *all* of
something with an inverse fisheye. Like looking at a neutron star, or one of
those map projections that shows all the earth on a circle.

    Useless? Probably, like super-ultra fisheye lenses.  But fun.

    -Robert Dawson


Post a reply to this message

From: Nathan Kopp
Subject: Re: spherical camera revisited
Date: 30 Jun 1999 18:58:24
Message: <377AA01D.29280736@Kopp.com>
Good idea.  At least I think so because I did this, too.  :-)  This is an
undocumented feature of UVPov (for the past few releases, at least).  I
originally wanted to use it to render a spherical image map for a sunset
(you know, the media clouds that take _hours_ to render).  Then I could
keep using that image map and my subsequent renders would be quick, but
still use a POV-generated sunset.  Never actually did that, though...
I went with a gradient sky instead.

-Nathan

Mike wrote:
> 
> I posted an image binaries.images that was rendered with a new camera I
> wrote.  While I'm here I'll let everyone in on how it works.
> 
> Basically you add the keyword spherical_camera and you can set the
> vertical and horizontal field of view using v_angle and h_angle
> repectively.  The camera renders as if the whole scene were projected on
> a sphere in a reverse manner to how spherical_mapping works.  It can
> also be thought of like the lattitude and longitude on a globe.
>


Post a reply to this message

From: Nathan Kopp
Subject: Re: spherical camera revisited
Date: 30 Jun 1999 20:17:34
Message: <377AB2AA.7E2DE796@Kopp.com>
At closer look, I like your version better (since you have v_angle and
h_angle and some other stuff that I left out).  I think it's worthy of
the superpatch.  :-)

-Nathan

> Mike wrote:
> >
> > I posted an image binaries.images that was rendered with a new camera I
> > wrote.  While I'm here I'll let everyone in on how it works.
> >
> > Basically you add the keyword spherical_camera and you can set the
> > vertical and horizontal field of view using v_angle and h_angle
> > repectively.  The camera renders as if the whole scene were projected on
> > a sphere in a reverse manner to how spherical_mapping works.  It can
> > also be thought of like the lattitude and longitude on a globe.
> >


Post a reply to this message

From: Mike
Subject: Re: spherical camera revisited
Date: 30 Jun 1999 23:54:11
Message: <377AE4AB.28AACF94@aol.com>
Thanks. :-)

I had been tinkering with this idea off and on for nearly a year.  The final
design goal I came up with is to have the viewing area be like a rectangle
projected onto a sphere (or the other way around).

A week and 5 trig books later I came up with the code I posted.  Heh heh.

-Mike

Nathan Kopp wrote:

> At closer look, I like your version better (since you have v_angle and
> h_angle and some other stuff that I left out).  I think it's worthy of
> the superpatch.  :-)
>


Post a reply to this message

From: Nieminen Mika
Subject: Re: spherical camera revisited
Date: 1 Jul 1999 03:54:18
Message: <377b1eaa@news.povray.org>
Robert Dawson <Rob### [at] stmarysca> wrote:
:     "inverse" in the camera definition to mean that rays are traced inwards
: from infinity. So you could see five sides of a cube... or *all* of
: something with an inverse fisheye. Like looking at a neutron star, or one of
: those map projections that shows all the earth on a circle.

  Seeing if the camera is inside a non-hollow object or not could be quite
difficult, since the camera is "everywhere" in this case... :)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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