1.Fisheye Distortion fish eye lens
Explanation from Baidu Encyclopedia: Fisheye Lens is a focal length of 16mm or shorter and the angle of view is close to or equal to 180 °. It is an extreme wide-angle lens, "fisheye lens" is its commonly known. In order to achieve the maximum photographic angle of view, the lens's front lens is short in diameter and protruding from the front of the lens, similar to the fish's eyes, hence the name "Fisheye Lens".
The key code is as follows:
FLOAT2 fisheye (Float2 uv) {Float2n_uv = (uv-0.5) * 2.0;float2 r_uv;r_uv.x = (1-N_UV.Y * n_uv.y) * _intensity_y * (N_UV). x); r_uv.y = (1-n_uv.x * n_uv.x) * _intensity_x * (N_UV.Y); return (uv* _scale-r_uv);}
The effect is this:
2.Barrel Distortion Barrel-shaped distortion
Barrel distortion (barrel Distortion), also known as barrel distortion, is caused by the lens physical properties and lens group structure of the imaging picture is a barrel-shaped swelling distortion phenomenon. We are most likely to detect barrel distortion when using a wide-angle lens or with a zoom lens. Barrel distortion is most noticeable when there is a line in the picture (especially a straight line near the edge of the frame). Typical consumer-grade digital cameras have a barrel distortion rate of 1%.
The key code is as follows:
FLOAT2 Barrel (Float2 UV) {Float2 h = uv.xy-float2 (0.5, 0.5); float r2 = h.x * h.x + h.y * h.y;float F = 1.0 + r2 * (_dist Ortion + _cubicdistortion * sqrt (R2)); return f * _scale * H + 0.5;}
The effect is this:
3.Pincushion Distortion Pillow Shape Distortion
Under the correct shooting conditions, the image of the rectangular object should still be rectangular. But some of the lens due to defects, the rectangular object into a four-sided concave shape like a pillow image, called the lens of this aberration is the occipital shape . On the contrary, the image is called barrel distortion.
The occipital distortion is also called positive distortion, because the magnification of the edge part of the field of view is higher than that of the center part, that is, the magnification of the light with large tilt angle is higher than that of the light with a small inclination angle.
the modification of the barrel distortion parameter is the shape of the occipital distortion .
The effect is this:
All code has been uploaded to GitHub
------by wolf96 http://blog.csdn.net/wolf96
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Several lens aberrations of Unity3d