Fisheye Lens Polynomial and LensFun database

Hi,

I was looking into how the Fisheye Lens Polynomial could help us creating distortion directly on the lens. There is a great open source database of lens distortion and lens vignetting available: https://lensfun.github.io/

The problem is that in Blender we have a 4th degree polynomial, while the database uses a third degree polynomial (a, b and c) or a simpler single value (k1) when the lens distortion is rather linear.

Is there a way to easily convert these into k0, k1, k2 and k3 values for the Fisheye lens polynomial?

Thanks!

3 Likes

I didn’t look into this specific situation, but normally a 3d degree polynomial is the same as a 4th degree polynomial with the 4th term set to zero?

So if you database specifies only k0,k1,k2 isn’t it enough to just set k3 to 0?

Mind you, I didn’t actually look at the code, but math wise this seems logical.

From a look at the lensfun API docs, they don’t seem to use the same distortion model, even if both involve polynomials. There’s no easy conversion I think.

Thank you for looking into it! I would be great if there was a Lens shader that would support the most common distortion models.

1 Like