Ray transformation of a 3d lens?

In summary, you are trying to model a lens as a primitive object, but you are having difficulty calculating where the ray would be diverted after it passes through the lens.
  • #1
Artlav
162
1
Greetings.

I'm working on a raytracer, and got stuck with trying to model a lens analytically.

Given is a thin lens at position p with the axis n, radius r and a focal distance f, a ray hits it at position p1 going in the direction d.
Which way would the ray be going on the other side of the lens?

The problem is, pretty much all i could google up assumes a rotational symmetry of the lens and talks in terms of an image of an object and similar 2D reduction.

But in 3D the rays mostly hit the lens not in plane with it's axis (the ray vector and lens' normal vector are not coplanar), and for that case i can't find a single mention anywhere.

The closest thing to a solution i can think of is to brute force it - drop the thin lens assumption, determine the glass-to-ray angle, do a refraction, find the intersect on the other side, do another refraction, get the answer.

Is there any simpler way to do this?
 
Science news on Phys.org
  • #2
It's not clear to me what you are trying to do. In ray tracing, you have a series of surfaces and, you find where the ray encounters each surface and calculate the new ray direction. A general 3-d ray tracer is quite complex.

Maybe you could explain a bit more what you are trying to do. By the way, what is the "axis n" of the lens? And a lens doesn't have a "radius," a surface does.
 
Last edited:
  • #3
Imagine a lens in front of you, on a table you're sitting at. It's at an angle to you.
Look at it's center.
Now shift that line of sight to the side.
You will get a ray that passes through a lens, and yet it's not coplanar with the axis of the lens (the line that is perpendicular to the plane of the lens and goes through it's center).

How would you calculate where this ray would get diverted after it passes through the lens?

I'm trying to make a lens as a primitive object (instead of a mesh for it, or some sort of a sphere transformation computed explicitly).
 
  • #4
Rays that aren't coplanar with the axis of the lens are known as skew rays. I edited my post - when I asked what you meant by "axis" it's because you described it with a single parameter, n, which wasn't clear to me what you meant. I know what a lens axis is.

I'm still trying to understand the scope of what you are trying to do - something relatively casual or a full-fledged ray trace program for an arbitrary set of surfaces. Ray tracing of skew rays is not easy.
 
  • #5
Artlav said:
How would you calculate where this ray would get diverted after it passes through the lens?
The initial ray direction and the surface normal define a plane. Within that plane you have the usual 2D refraction.
 
  • #6
For a simple case, why not just apply Snell's Law to the each ray at each surface of the lens? That would take the ray through both surfaces correctly. You wouldn't actually need to approximate the lens surfaces to a mesh - all you need is the radii of curvature and the direction of the principle axis.
It's the sort of thing that would be best approached with a 2D model.
But Ray Tracing has had such a lot of work on it in the last few years that you will have a lot of trouble working it out for yourself. to the level that's used these days. There will have been so many algorithms invented, to improve on efficiency and speed that you'd probably be best to approach the topic by studying what's been done already, rather than inventing it for yourself. There will be so many blind alleys for the beginner. . . . . .
 
  • #7
A.T. said:
The initial ray direction and the surface normal define a plane. Within that plane you have the usual 2D refraction.

That's true of course, but the difficulty is calculating the location of that plane, especially for a skew ray.

OP: if you are just beginning to learn ray tracing, I'd suggest you start with a paraxial ray trace - you define the system as a set of surfaces, indices of refraction and separations and apply simple equations at each surface.

Otherwise, the section titled Vector Form at the following link is what you are looking for. It shows how to calculate the reflected and refracted rays knowing the ray direction and the direction of the normal at the surface, as A.T. suggested: https://en.wikipedia.org/wiki/Snell%27s_law[
 
Last edited by a moderator:
  • #8
Artlav said:
Greetings. I'm working on a raytracer, and got stuck with trying to model a lens analytically.

Tracing skew rays is not fun. The MIL-HBDK-141 reference lays it out in detail, but in the end it is a brute-force method:

http://fp.optics.arizona.edu/OT/MIL%20HDBK/ch05.pdf

(after a lot of information, an example trace is presented in Table 5.2)

What raytracer are you currently using?
 
Last edited by a moderator:
  • #9
Ah. Skew rays was the googleable term i was looking for.
Thanks.

I'm just exploring what can be done with raytracing, making one myself. Since it's not for anything important or for profit, i find it more valuable to (re-)invent things myself rather than look at things already done and figured out.

In this particular case i wanted to propagate light from the sources until it hits the camera, which requires a working optical model of the said camera - at minimum one lens. Looks like the simplest way would be to preserve the generality and explicitly define the model in the scene.
 

1. What is the purpose of a Ray transformation in a 3D lens?

A Ray transformation in a 3D lens is used to manipulate the direction and position of light rays passing through the lens. This allows for precise control of the image produced by the lens.

2. How does a Ray transformation affect the focal length of a 3D lens?

A Ray transformation can change the focal length of a 3D lens by altering the curvature of the lens surface. This can either increase or decrease the distance at which the lens focuses light, depending on the specific transformation applied.

3. What factors determine the type of Ray transformation used in a 3D lens?

The type of Ray transformation used in a 3D lens is determined by the desired properties of the resulting image. This includes factors such as image magnification, distortion correction, and depth of field.

4. Can a Ray transformation be used to correct visual aberrations in a 3D lens?

Yes, a Ray transformation can be used to correct visual aberrations in a 3D lens. By carefully manipulating the paths of light rays, aberrations such as chromatic aberration and spherical aberration can be minimized or eliminated.

5. How does a Ray transformation in a 3D lens impact the overall performance of the lens?

A Ray transformation can greatly impact the performance of a 3D lens, as it directly affects the quality and characteristics of the produced image. A well-designed and optimized Ray transformation can result in a high-performing lens with minimal aberrations and excellent image quality.

Similar threads

  • Optics
Replies
8
Views
2K
Replies
20
Views
3K
Replies
2
Views
1K
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Replies
2
Views
1K
  • Introductory Physics Homework Help
Replies
5
Views
1K
  • Advanced Physics Homework Help
Replies
5
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
864
Back
Top