POV-Ray : Newsgroups : povray.advanced-users : About types of projections : Re: About types of projections Server Time
30 Jul 2024 08:25:18 EDT (-0400)
  Re: About types of projections  
From: Margus Ramst
Date: 6 Dec 1999 13:04:29
Message: <384BFB3B.E3C15390@peak.edu.ee>
Well. You asked for it, you are gonna get it...

I will not delve into the principles and problems of mapping a 3D topography
onto a 2D surface. For this, I suggest you see one of the many web pages dealing
with map projections.
In the text I mention 'model space' and 'screen space'. By 'model space' I mean
the virtual 3D space of the scene, and by 'screen space' I mean the 2D surface
(e.g. your monitor) onto which this scene is rendered.

-------------------------------------------

The basic differences between the cameras are:
a) is the view point fixed or not, if not how does it move;
b) in what directions are the rays shot (in relation to the viewpoint);
c) to what topography are the resultant samples mapped (in 3D model space and in
2D screen space).
Once you know these parameters of a particular projection, it just takes a bit
of visualisation to predict the resulting image.

-------------------------------------------

The basic perspective camera and orthographic camera use simple planar
projection. Planar projections have the property of keeping straight lines in
the scene straight also in the image. However, in all cases but orthographic,
planar projections distort distances. The distortion increases towards the edges
of the image.

Orthographic projection is pretty straight-forward: all view rays are parallel
and equally spaced, so there is no perspective, and no distortion of distances.

The standard perspective camera traces rays from a fixed viewpoint, mapping
samples to a rectangle. Because the horisontal and vertical angle between camera
rays remains constant, they do not hit the rectangle at constant intervals.
Instead, they are positioned more sparsely towards the edges of the rectangle.
This is what causes the distortion of distances (stretching) I mentioned
earlier.

-------------------------------------------

The fisheye, ultra_wide_angle and omnimax projections are types of spherical
projection, i.e. the samples are mapped to a sphere. Spherical projections can
avoid distortion of distances, but they cannot keep straight lines in the scene
straight in the rendered image.

The fisheye projection maps the image to a sphere (or a section thereof) in
model space and to a circle in screen space. The direction in which the camera
looks is at the center of the image. You can then imagine the consecutive rays
being rotated more and more towards the opposite pole of the sphere. The
outermost rays form the fringe of the circle. If the camera has a 360 degree
angle, all outermost rays point towards the opposite pole and all pixels at the
fringe of the circle represent the same point.
NB! The render of a 360 degree fisheye camera _cannot_ be used as an
image map for spherical mapping (map_type 1). The fisheye camera maps the scene
with polar coordinates, whereas map_type 1 needs an image with rectangular
coordinates. Polar to rectangular conversion of a bitmap is possible, but lossy.
There exists an unofficial version of POV has a spherical camera which yields an
image with rectangular coordinates. Hopefully this will also make it into
official POV.

The ultra_wide_angle projection is a bit unfamiliar to me, but here's a guess.
It works the same way as fisheye in model space - but in screen space, a section
of the sphere is orthographically mapped to a rectangle.

The omnimax projection is just a specialized type of fisheye. The screen output
is somewhat elliptical, as you can see yourself. In model space, the samples are
probably projected to a sphere that has been flattened along the up vector.

-------------------------------------------

The panoramic and the various cylinder cameras use cylindrical projection. In
model space, they are mapped to a cylinder; in screen space, to a rectangle. In
terms of distortion, they share common properties with both spherical and planar
projections.

Cylinder 1&2 projections are pretty easy to visualize. The viewpoint is fixed at
the center of the cylinder. Along the axis of the cylinder (i.e. up or sideways,
respectively), they have the properties of standard perspective projection
(fixed viewpoint planar projection): lines parallel to the axis, that are
straight in 3D, stay straight in the rendered image; features are stretched
along the axis as they near the edge of the image. Along the perpendicular
direction (sideways or up, respectively) they have the same properties as
spherical projection: no stretching towards the edges, but lines that are
straight in the scene do not stay straight in the rendered image.

Panoramic projection is rather similar to cylinder 1 projection. In cylinder 1,
vertical angle of the rays changes constantly, but consequently the rays do not
hit the cylinder at constant vertical intevals. This is what causes stretching
at the image edges in both cylindrical 1&2 and perspective projection. Panoramic
projection tries to counter this by varying the amount by which the vertical
angle of rays changes from row to row. This allows the samples to be spaced in
an uniform grid (i.e. in an equirectangular configuration) over the entire
cylinder, thus reducing distortion of distances.

Cylinder 3&4 projections are quite simple. The viewpoint is fixed at the axis of
the cylinder, but moves down as the render progresses. Thus the projection is
orthographic along the axis of the cylinder - there is no perspective along the
axis, far objects do not seem smaller. Along the perpendicular direction it
again acts like spherical projection - there is perspective, but straight lines
do not stay straight. Because in one direction there is perspective and along
the other there isn't, objects - esp. distant objects - seem stretched along the
orthographic direction. Objects that cross the view diagonally look especially
weird, since they appear both bent and stretched in the image.

-------------------------------------------

I hope this <ahem> brief tutorial proves helpful. If not, ask and I will try to
explain in a more intelligible manner.

Margus


Post a reply to this message

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