2
$\begingroup$

I want to render the depth map of a mesh I created from a 3D scanner. I already managed to render my image and it is nearly fine.

However, I also want to apply a lens distortion to my output (the image should appear as if it was created by a camera with certain parameters). All the camera parameters (K1, K2, P1, P2, K3) are known, but I can't find the option to enter them. I already spent quite some time studying the documentation, searching this site, and reading/watching tutorials. However, my settings/properties look quite different than in all explanations.

It should look somewhat like this:

How it should look like

(see How to determine lens undistortion values for motion tracking? or Tutorial on YouTube)

Instead, my settings look like this:

How it looks like

The distortion nodes "Lens Distortion" / "Movie Distortion" didn't really do the job as I have a more complex distortion model (radial and tangential up to order three).

Related similar question: Customize blender camera distortion

$\endgroup$
2
  • $\begingroup$ First screenshot shows 2.7x and the other - 2.8x. Both don't seem to show identical settings. Do you mean you can't find Calibration option in 2.8x? $\endgroup$ Jun 3 '20 at 10:08
  • 1
    $\begingroup$ Yes, kind of. The 2.7 screenshots are from other tutorials, the 2.8 screenshots are mine. brockmann's solution worked fine for me. $\endgroup$
    – Gnnr
    Jun 3 '20 at 12:41
3
$\begingroup$

You can enter the distortion data per loaded 'clip' in the 'Track' panel of Movie Clip Editor (N) and use a Movie Distortion node in the Compositor to distort your image based on the values:

enter image description here

I'd suggest go to the 'Compositing' workspace, enable 'Use Nodes', switch the editor type of the 'Timeline' to 'Movie Clip Editor', load any arbitrary image with the same aspect ratio, set your values for K1, K2 etc. and add a Movie Distortion node to your node stream in the compositor.

$\endgroup$
4
  • $\begingroup$ That's what I was looking for. Thank You! But apparently, there is no option for tangential distortion (p1 and p2 in most notations), right? $\endgroup$
    – Gnnr
    Jun 3 '20 at 14:19
  • 1
    $\begingroup$ Glad I could help. Not exactly sure what tangential distortion is. However, there is a new distortion model implemented as of Blender 2.90 which might help or/and should be a good starting point on how to implement your own custom model. Patch: developer.blender.org/D7484 @Gnnr $\endgroup$
    – brockmann
    Jun 3 '20 at 17:46
  • $\begingroup$ Wow, that would be quite a task for me, but I will consider it... FYI @brockmann: Tangential distortion happens when an image sensor is not exactly parallel to the lens (which is to some degree usual due to production tolerances). See here: MATLAB Explanation (scroll down to just before the references) or here: OpenCV Documentation (scroll down just below the figure of the pinhole model) $\endgroup$
    – Gnnr
    Jun 4 '20 at 8:08
  • $\begingroup$ If the new model doesn't help, you can try to reach Sergey over on blender.chat Thanks for the links, on my reading list. Also consider that cycles is using a pinhole camera Cycles generates distorted depth Anyway, keep me posted @Gnnr $\endgroup$
    – brockmann
    Jun 4 '20 at 8:31

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.