POV-Ray : Newsgroups : povray.general : simulating lens distortion with normal and function in 3.5 : Re: simulating lens distortion with normal and function in 3.5 Server Time
6 Aug 2024 17:01:47 EDT (-0400)
  Re: simulating lens distortion with normal and function in 3.5  
From: Mike Williams
Date: 26 Feb 2002 01:05:04
Message: <GrdmVGAE7we8Ewal@econym.demon.co.uk>
Wasn't it Bill Brehm who wrote:
>Thanks Mike.
>
>1. Where does the 0.016 for Z come from? Is that a constant built into
>POVRay? 

I haven't a clue. I just did some experiments and that's where it turned
out to be. It's possible that the camera{} parameters may affect it.

>Do X and Y both vary from -0.5 to +0.5, even though the camera is
>rectangular (3/4)?

Yes.

> Then I need to consider the camera's aspect ratio in my
>function, right?

It may be more sensible, in your case, to work with square images.

>2. When would I want to use Z, if it is a constant? Do one or more of the
>camera types have a variable Z? Is it useful when the camera is translated
>in some way?

Probably not in your case.

>3. POVRay help shows an diagram explaining the perspective camera. The rays
>emanate from "location", pass through the image plane, then eventually hit
>an object. Those rays are not normal to the plane, except at the center. For
>the orthographic camera, one could consider that "location" is infinitely
>far away, so that the rays are normal to the image plane. Or one could
>consider that the rays emanate from the image plane itself normal to the
>plane.
>
>I'm I correct so far? Assuming yes,

I believe so.

>Can I imagine that the normal function distorts the image plane into a shape
>determined by the scalar field and that the rays emanate from that distorted
>image "plane" normal to the "plane" at that point?

That's probably not a very helpful way to visualize it. Try thinking of
something like a freznel lens or a diffraction grating, where the
surface is flat but it changes the direction of light that passes
through it.

> Is that still true for a
>perspective camera with a normal applied to it? I.e., should I sort of
>forget about "location" and think of a perspective camera as having an image
>plane distorted into a piece of a sphere having the rays emanate normal to
>that distorted image "plane"? Couldn't  I then simulate any camera type with
>the proper normal function?

I guess you could simulate any camera by changing the normal. E.g. if
you set a_factor and b_factor to zero in your lens_dist() function, then
you're simulating a perspective camera with angle 20.5 (approximately).

>How does POVRay actually determine the normal at each point? Does it use the
>derivative of the function to calculate it exactly or does it look at the
>surrounding points and calculate a rough approximation? (I'm trying to
>generate "perfect" images with a known amount of lens distortion to test a
>correction algorithm.)

I don't know. I do know that POV normals do work with functions that are
fiendishly difficult to differentiate analytically, so I guess that it's
using some sort of numerical approximation method.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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