Skip to main content
New Participant
March 30, 2013

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

    Up and Coming
    March 30, 2013
    From this thread it looks like they might be:
    param_named HmdWarpParam float4 1.0f, 0.22f, 0.24f 0
    kojack
    Honored Contributor
    March 31, 2013
    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);
    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3
    Up and Coming
    April 1, 2013
    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 :)
    stepanKAuthor
    New Participant
    April 2, 2013
    @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 :)