4
$\begingroup$

Is it possible to create a custom nonlinear distortion lens in Blender?

I'm assuming that Blender superimposes a rectangular grid in front of the eye, and fires out a ray through the center of each cell on the grid, returning the colour for that pixel.

enter image description here

So my question reduces to: is it possible to replace this grid with my own warped grid?

EDIT: I'm most interested in a code-level solution -- this is for experimental project and as such I would like fine-grained control.

PS I can't find any tags, such as ray-tracing, eye-ray, lens, distortion

$\endgroup$
1
  • 1
    $\begingroup$ You may want to try this patch. $\endgroup$
    – gandalf3
    Commented Apr 3, 2014 at 8:01

2 Answers 2

5
$\begingroup$

Why not use the compositor to achieve this affect?

Doing this in the compositor is really easy. All you need to do is to add a lens distortion node. enter image description here

enter image description here enter image description here

$\endgroup$
5
  • $\begingroup$ I thought cycles did support fish-eye lenses? $\endgroup$
    – gandalf3
    Commented Mar 7, 2014 at 21:23
  • $\begingroup$ @gandalf3 I see no option for it? $\endgroup$
    – Vader
    Commented Mar 7, 2014 at 21:28
  • $\begingroup$ There is a fish-eye option in Camera > Panoramic > Type. $\endgroup$
    – gandalf3
    Commented Mar 7, 2014 at 21:41
  • 1
    $\begingroup$ oops you are right $\endgroup$
    – Vader
    Commented Mar 7, 2014 at 22:05
  • $\begingroup$ But what if you want the camera to use the same lens distortion values (k1, k2, and k3) that camera tracking determines? $\endgroup$
    – Chuck
    Commented Jan 31, 2015 at 20:20
1
$\begingroup$

If you want to work at the code level -

  1. You can use a custom blender code base by adding your own node that does what you want. Complicated but will give you access to the most data and the most flexibility that is available in the render engine.
  2. Pynodes allows you to create your own nodes, I'm not sure what capabilities these offer. There is a custom nodes example in templates. I believe luxrender uses pynodes to add nodes specific to luxrender.
  3. Create an OSL shader. The limitation would be the object with the osl shader so you probably won't get the full image distortion that you want.
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .