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
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Mimic real life lens camera properties

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

  1. IBuro


    Jul 7, 2017
    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


    Dec 7, 2012
    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.