POV-Ray : Newsgroups : povray.advanced-users : mesh camera help needed : mesh camera help needed Server Time
5 May 2024 05:45:16 EDT (-0400)
  mesh camera help needed  
From: CAD-Andi
Date: 16 Oct 2015 09:10:00
Message: <web.5620f6f32e1c6f5a7a3d9a3d0@news.povray.org>
Hello!

Im trying to figure out ways to achive different types of projections.
The typical "perspective" camera in povray is known as "Gnomonical".
Apart from that there are some other projection methods I'm interested in.
Stereographic, Equidistant, Equisolid angle, and Orthograpic.
(See: https://en.wikipedia.org/wiki/Fisheye_lens)

I found Clemens Rabe's Lens Distortion patch, but I can't install it, since I
run POVRay for Windows and can not compile his code (Im not a coder).

I found some helpful macros to generate mesh-cameras by Jaime Vives Piqueres
from 2010. He implemented an example of a meshcam_lens that can uses a
distortion factor (c_distort: >0=barrel, <0=pincushion) to create a lens
distortion effect. His website where he posts his work:
(http://www.ignorancia.org/en/index.php?page=mesh-camera)

Still I don't know how he implemented the distortion, and what type of
projection it is using. Essentially he generates a mesh camera tha acts as a
regular perspective camera and then alters the vertexes (vtx_1-3) for the mesh
triangls with these formulas:

vtx_1=vtx_1-c_distort*pow(abs(vtx_1.x)*abs(vtx_1.y),2)*z;
vtx_2=vtx_2-c_distort*pow(abs(vtx_2.x)*abs(vtx_2.y),2)*z;
vtx_3=vtx_3-c_distort*pow(abs(vtx_3.x)*abs(vtx_3.y),2)*z;

c_distort is the camera distortion factor he uses in his macro.

He multiplies the absolute vertexes components of x and y and calculates the
power of 2. Then he multiplies that with z(?) and also with the distortion
factor. then he subtracts the whole thing from the original vertex

I successfully implemented the projection methods and formulas as tehy are
discribed on wikipedia (See: https://en.wikipedia.org/wiki/Fisheye_lens) within
a parametric CAD System. Now I would like to be able to render images with
povray using these exact projection methods.

Can somebody give he a hint and nudge me in the right directon as far as how i
could achive this?

The input variables for the wikipedia formulas are "f=focal length" and the
angle under which the "ray" hits the focal point. The result "r" is the distance
measured from the new point on the projection screen to the perpendicular center
from the focal point. All this is calculated of course in a 2D plane. To project
3D Points in CAD I just had to stay on this plane, rotated around the "optical
axis" So, in a sense I work with a hybrid of kartesian and polar coordinates to
get the point on the virtual CAD screen.

Anyway, any help or general thoughts on using any of these mathematical
projection methods or even real world camera formulas is welcome.

PS: It is weird that Wikipedia uses the term "Orthographic" to describe a
certain projection method for a fisheye lens, while povray usies "Orthographic"
to generate what I call a parallel projection.

Gnomonical     (perspective povray camera)
Stereographic  (different type of projection method)
Equidistant    (different type of projection method)
Equisolid angle(different type of projection method)
Orthographic   (fisheye method in wikipedia / parallel projection in povray)



Thanks in advance
Andi


Post a reply to this message

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