Lens distortion models

For computer vision and machine learning, there is often very helpful to generate synthetic datasets using Blender, etc. It often comes in hand with specific camera distortion.

I think it would be nice, to add other widely used distortion models. Even better would be to add an option to define custom lens distortion models.

I would very much like like to be able to use the rectilinear/fisheye in this form: link


Because there is not an option for rectilinear lens distortion, I had to use the fisheye polynomial model, which unfortunately does not correspond to the OpenCV fisheye model: stackoverflow link


Is there any other way to get the rectilinear distortion model into a camera? If there isn’t I would be interested in helping with the development of such a feature/extension.

Other users would welcome such a feature: forum link

4 Likes

Patches to add more distortion models are welcome.

It would be good to then also check how it corresponds to the distortion models in motion tracking, and try to get some consistency. Ideally we’d support all the same models as motion tracking. The rectilinear lens distortion looks similar to the Brown model in motion tracking, but I have not checked if it’s exactly the same.

4 Likes

I agree, it would be great to have lens distortion on cycles camera settings instead of using compositor.
(Also maybe, it would be great to have chromatic aberation thats is consistent with lens distortion (more aberation on distorted areas and contrasty pixels) in cycles render settings if viewport compositor comes)
and thanks for the tip that fisheye polynomial can be adjusted to make it similar to common lens distortions

As I stated somewhere else, the most elegant and logical way -imho- would be to have “Camera nodes”, to set this kind of effects and imperfections, as lens dirt, flares, etc…
Also camera nodes could be the right place to set a render resolution override

2 Likes

Yes after nodes are implemented, it can still be accessible without nodes in camera properties panel for people who dont wanna open node editor, it can have both UI as panels and node editor. Camera nodes would be a goodway to choose camera materials instead of tweaking settings of each camera one by one

Wouldn’t it make more sense to add this to the RT compositor Lens Distortion node

1 Like

I admit that there’s a blurry line between Realtime Compositor and this camera nodes idea.
Maybe the compositor nodetree, instead of being at scene level, would make more sense to be a camera thing, or cameras could override the scene composition. Or even better: camera nodetree output is what feeds the renderlayer node

yes but

Currenlty compositor cannot do it with only 1 node tree, there is need for multiple compositor node materials so we can assign/link a compositor node tree material to different cameras, not all cameras will going to have same distortion level
Also, Lens distortion in camera is real its not same as the post processed lens distortion, this is more accurate, so this page usually talk about camera lens distortion models, not like post processing a 2d image

By the way, you are right about blurry line, There is a ‘‘compositor ideas’’ tread, where I explained the idea of having multiple compositor materials and assigning them to cameras to combine camera with compositor materials instead of one compositor for whole scene, u can check that tread instead if you also want to have non-scene level compositor node tree materials