Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Edge Distortion on Camera

Discussion in 'Editor & General Support' started by KRGraphics, Mar 18, 2013.

  1. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,998
    Hey guys, I have another issue that is seemingly bugging the hell out of me... every time an object, especially a character reaches the edge of the screen they stretch and getting wider... is there a way to minimise this aside from using a small FOV? Here is a render of the issue I am having and it is getting annoying... i don't see this in other games...

    $Camera-Distortion.jpg
     
  2. dasbin

    dasbin

    Joined:
    Jan 14, 2012
    Posts:
    260
    http://en.wikipedia.org/wiki/Perspective_projection_distortion

    Most games, by default, have a very narrow FOV (usually 70-80 degrees) which minimizes perspective distortion.
    Unity seems to usually default to a slightly wider FOV which exacerbates it.
    It's an unavoidable effect of rendering a 3D space on a 2D plane.

    That said, no image is attached in your post, so we can't be certain what you're speaking of.

    The only way to eliminate perspective distortion is to resort to something like fisheye projection, which makes the image appear distorted in a circular fashion. Or go orthographic.
     
    Last edited: Mar 18, 2013
  3. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,998
    Going orthographic is something I would rather not do unless I could get it to work effectively... here is the image in question. Most likely I would have to try to keep the model from the edge of the screen... $Camera-Distortion.jpg
     
  4. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    13,053
    What you're showing is perfectly normal in 3D engines, as dasbin says. Most games minimise the effect simply by using as narrow a field of view as possible. You're using a wide FOV with a wide aspect ratio, so the effect is being maximised.
     
  5. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,998
    I was referencing Skyrim, which uses a high FOV to see as much of the level as possible... I could cut down the FOV to something like 30, but I will have to experiment with camera placement...and I would have to find out a good FOV for fighting games
     
  6. Emre

    Emre

    Joined:
    Jul 8, 2012
    Posts:
    21
    I don't think that it is normal and unavoidable. Considering that 3DS Max has a camera correction modifier and PS has a lens correction filter, these perspective distortions are certainly avoidable. Also, in Unity, you have access the rendered image and you can alter it as you wish before displaying it.

    Finding a good and an efficient solution as Autodesk and Adobe did may require a lot of work, but if you manage this, I believe it can be a good product for asset store. Good luck.
     
  7. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,659
    It is normal, there is no doubt about that.

    The PS lens correction filter is not the limit of this problem's attempts at being corrected, its a pretty big concern in the photography field and other post softwares such as lightroom generally provide a very specific pincushion style adjustment to images if you want. They read the EXIF data and see exactly what lens took the picture, then apply the correct inverse distortion (which are prefabs from the manufacturer - mind you) to result in a flatter image but the actual distortion in the picture is not tehcnically fixable except in a few softwares and the result will be a very narrow, wide, flat image that you can't actually support on your monitor. The extents of the screen are the true issue. The eye does not have such unnatural distortion because of the massive ~180 degree FOV that cannot be duplicated on a flat monitor without distortion or extremely short picture frames. Wide angle views will distort the image near the edges. The best you can do is apply reverse distortion or lower the fov.
     
  8. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,998
    The lowest I have gone for the FOV is 30, but i wanted to see more of the level with a higher FOV, a lot of games like Skyrim do this... and how would I apply reverse distortion?

    EDIT: I could also make sure the fighters in my game dont reach the edge of the screen
     
    Last edited: Mar 21, 2013
  9. Emre

    Emre

    Joined:
    Jul 8, 2012
    Posts:
    21
    Did you ever tried the camera correction modifier on 3DS Max? It deforms the frustum of the camera in a way to make it possible having a non-uniform FOV camera.

    In the field of computer imagery, we don't need to be limited by optical lenses or real world physics rules. Chromatic abberation might be a nightmare for a photographer but it is not even exist in our world.

    Theoretically, having a non-uniform FOV camera, which has highest FOV value at the center and lowest at the edges can reduce this distortion. I accept there can be many problems to be overcome, like different screen aspects, camera angles, object distances etc. but it is just about how much time you can spend to achieve the best result.
     
    Last edited: Mar 21, 2013
  10. dasbin

    dasbin

    Joined:
    Jan 14, 2012
    Posts:
    260
    Lens distortion (which can be corrected in PS) is *not* related to perspective distortion, which is what you are seeing. This is nothing to do with an optical distortion or anything like looking through an imperfect lens... it is just only the consequence of rendering a 3D space on a 2D plane (your monitor) and it will get worse with a wider FOV. Optical lens distortion is usually in the form of fisheye (circular) distortion, which is actually the opposite of perspective distortion. If you want to eliminate perspective distortion, the only things you can do within the realm of physics is apply something like a fisheye distortion to counter the effect or minimize the FOV. This will make objects near the edge of the screen the same size as when they are near the centre, but they will flex in a circular fashion around the center. There is no other way really. Sorry.

    Skyrim etc. has plenty of perspective distortion, just like in your screenshot.
     
    Last edited: Mar 21, 2013
  11. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,998
    I am probably enjoying the scenery too much to notice... I will just leave it alone... :D
     
  12. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,270
    Last edited: Jul 5, 2017
  13. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,998
  14. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,270
unityunity