Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mimic real life lens camera properties

Discussion in 'General Graphics' started by IBuro, Jan 26, 2018.

  1. IBuro

    IBuro

    Joined:
    Jul 7, 2017
    Posts:
    3
    Hi!
    I need to make an exact replica in unity of a given image. I have specific data regarding the camera (sensor size, focal length, etc). The problem is that unity does not mimic the distortion of the lens camera, and the field of view property is not enough.

    I think that something similar to this would be the perfect solution:



    But I didn't find the specific project nor an asset to work with. Neither did I find something to work around the distortion of a real camera (elements getting closer/farther as the camera zooms, as seen on the video above, not just making the image bigger/smaller).

    I hope I'm clear of what I want.

    Question is... is there some real solution to this issue? I spent a couple of days of research, and found similar solutions (like octane render camera), but no the real deal.

    Any answers would be much appreciated!

    Thanks in advance!
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    You're talking about lens distortion. Sometimes referred to as barrel distortion or fish eye distortion (generally used for higher FOVs, but the concept is the same). Real time render is general done with rastorization, which basically uses the pinhole camera model.

    However you say you need to match a camera perfectly, and the reality is that's not possible with out specialized equipment because every lens is different. GPU based barrel distortion has gotten a lot more attention lately due to VR, mainly for handling the distortion caused by the lenses in the headsets. To accomplish this accurately every single headset made has to have the lens distortion measured, and it's unique distortion profile is stored in onboard memory. (Low end headsets, like most mobile phone based VR HMDs, don't do this.) You can approximate it by using one of the various barrel distortion algorithms out there, but it's unlikely to match a physical camera you have.