Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
stepanK's avatar
stepanK
Honored Guest
12 years ago

coefficients of distortion function...

I may be overlooking something, but can someone share recommended values of constants k0, k1, k2 and k3 in optical distortion function that warps the linear image into pincushion distorted prior sending to the helmet? The function is no rocket science, but I'd love to avoid looking these 4 numbers by trial and error ;)

Thanks in advance!

4 Replies

  • I got those numbers by creating an OVR::Util::Render::StereoConfig object and calling it's GetDistortionK() method. The numbers seem to be the default for no hmd detected.
    (If you have a hmd connected, you can get it's HMDInfo and give it to the StereoConfig to set it up)

    I did this:
    if(m_oculus)
    {
    m_oculus->GetDeviceInfo(&m_oculusInfo);
    m_stereoConfig.SetHMDInfo(m_oculusInfo);
    }

    float d1 = m_stereoConfig.GetDistortionK(0);
    float d2 = m_stereoConfig.GetDistortionK(1);
    float d3 = m_stereoConfig.GetDistortionK(2);
    float d4 = m_stereoConfig.GetDistortionK(3);
  • Perhaps of little practical benefit to determine the magic coefficients ;) , but an insight nonetheless, the distortion function is the first four terms of a Taylor series expansion of the sin() function (multiply in the "r"):

    sin(r) ~= k_0 r + k_1 r^3 + k_2 r^5 + k_3 r^7 + ...

    I believe the Rift uses spherical plano convex lenses, and this produces a radially symmetric distortion, thus the shape of a circle becomes relevant, which sin() captures :)
  • stepanK's avatar
    stepanK
    Honored Guest
    @zalo - thanks, that is exactly what I was looking for! I am python coder with very different needs from typical OVR users, would have to install MSVC, which You saved me from :)