4

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

Leon Cheung
  • 27,718
  • 11
  • 89
  • 161
P i
  • 3,921
  • 9
  • 34
  • 53

2 Answers2

5

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

user2699
  • 867
  • 5
  • 13
Vader
  • 14,680
  • 16
  • 74
  • 110
1

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.
sambler
  • 55,387
  • 3
  • 59
  • 192