I know that objects can be assigned a transparent, refractive material, but is there a way to create a simple ideal lens? I'm trying to set up a 4f optical system as part of a camera array (it shifts the captured real and virtual spaces away from the camera array) and would love to be able to skip dealing with aberration and lens modeling.

  • 2
    $\begingroup$ maybe related: blender.stackexchange.com/questions/9091/… $\endgroup$ – cegaton Apr 16 '16 at 3:40
  • 5
    $\begingroup$ It's quite easy to make a lens-shaped object and make it refract light. Here's an example I made in a few minutes. If have very exact parameters for the shape of the lens it could get trickier, depending on how you would like to define them. Exactly what capabilities are you looking for? $\endgroup$ – gandalf3 Apr 16 '16 at 6:29
  • $\begingroup$ Somehow related: youtube.com/…; and maybe you might want to deal with caustics? $\endgroup$ – Samoth Apr 16 '16 at 16:21
  • $\begingroup$ I realized I can make equivalent ray paths with mirrors. Can I set it up so the camera only sees the reflection from mirror 1, which only gets light from mirror 2, and that sees everything but mirror 1? $\endgroup$ – Robert Szasz Apr 17 '16 at 0:30
  • $\begingroup$ osapublishing.org/oe/abstract.cfm?uri=oe-16-18-13969 Is essentially what I am trying to implement. where instead of a lens array and telecentric lens, I just have an array of cameras in blender. $\endgroup$ – Robert Szasz Apr 17 '16 at 1:28

Idle Chit-chat

I could not make sense of the link in your last comment, but I was able to create the setup from your next to last comment in Cycles render. I did not spend a great deal of time modeling the camera (it's a rectangular prism missing one of its bases [where the lens would be] and half a face [for the actual camera to see through]).


Before you can begin to understand this setup, you have to have an understanding of how Cycles works. In real life, photons come from an emitter, like the sun, bounce off objects, and eventually make their way into our eyes. In Cycles, it's the inverse. 'Camera rays' come out of the camera, bounce off meshes, and make their way to a light source. This is the primary reason why a bigger light source is less noisy in Cycles: There is a bigger area of light (for a camera ray) to find.

Camera rays are not the only rays, or Light Paths as they are more commonly known, in Cycles. There are Shadow Rays, Diffuse Rays, Glossy Rays, etc., but the only two you will need to be familiar with are Camera rays and Reflection rays.

enter image description here

This is the material for Mirror 1. We will be using it. It is very similar to that of a one-way mirror. Camera rays are 'photons' that come directly out of the camera and have not bounced off a mesh yet. They are important, because I use the Is Camera Ray fac from the Light Path node in the material for the first mirror (above). The fac differentiates between a Glossy BSDF (mirror shader) and a Transparent BSDF (for the second mirror to see through). The material basically says, "Normally use Transparent BSDF. This will let light from the second mirror pass through me. If the light that hits me happens to be from an unaltered camera ray, however, use the Glossy BSDF so that I act like a mirror."

enter image description here

This is the material for Mirror 2. It is a simple mirror material because that is all that the second mirror does; it doesn't have any special properties.

enter image description here

This is the material for the camera tube. We will be using it. Reflection rays are 'photons' that have bounced, but in the bounce, reflected perfectly off an object. A reflection ray would be like shining a laser pointer at a mirror. The photons that have bounced off the mirror but not yet hit an object would be Reflection rays. They are important, because I use the Is Reflection Ray fac from the Light Path node in the material for the camera tube (above). The fac differentiates between a Diffuse BSDF (outside appearance shader) and a Transparent BSDF (to not get in the way of the second mirror). The material basically says, "Normally use Diffuse BSDF. This will let outside objects view me. If the light that hits me, however, happens to be from a reflection ray, like that from one or both of the mirrors, use the Transparent BSDF so that I do not appear as a border around the final rendered image."

The Setup

enter image description here

The above is the actual setup. I selected the two mirrors for clarity (1 is yellow, 2 is orange). The cube off to the right side was just a cube that the camera could view. It's blue, but that's unimportant. I also used the cube when I was aligning the rotation of Mirror 1. It gave me a point that I knew should be at the center of the camera's view. It told me that I had to use a rotation of -46.3, rather than -45 (my guess).

Last Notes

Because of the distance the ray has to travel, I realize that the cube can look farther away than the camera would normally view it. My solution is that you select the camera, go to the Camera Object Data tab in the Properties panel, and change the Focal Length: from the default 35.00 to 152.00. This will show the cube as it would be seen from the front of the camera. Don't be alarmed by how far the camera object stretches out. That's normal.

Lastly, there is no lens distortion, and to add a reflective material in the 3D to this setup would not be wise. To add lens distortion, go to the compositor and use this node setup:

enter image description here

It will bend the cube and slightly distort some colors.

To Help Out...

As I realize this could be very time consuming to make, I took the liberty of including a .blend file.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.