Forum Discussion

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

OVR Lens Correction

Hi all,

I want to ask about the OVR Lens Correction image effect, which is used to distort the camera to make a "fish-eye" effect.

I notice that the fish-eye effect can only appear when you have the device plugged-in. My colleague who has the device has the effect appears, whereas in mine there's no distortion. If you check/uncheck the "Lens Correction" setting, nothing changed at all.

My question is: Is there any way to force the effect to appear even if you don't have the device?

I also use highlighting effect component which will display white outline on the selected object. Same with OVR lens correction, it uses render-to-texture to create the effect. The problem is it's not compatible with OVR lens correction. The outline will be rendered without the lens correction, causing it to have different shape compared to the highlighted object.

My 2nd question is: How do I include OVR lens correction effect to another render-to-texture component?

Thanks in advance!

2 Replies

Replies have been turned off for this discussion
  • drash's avatar
    drash
    Heroic Explorer
    "mitsurudy" wrote:
    My question is: Is there any way to force the effect to appear even if you don't have the device?
    Yes, but probably not guaranteed to be good for anything other than DevKit1 (and might change with future SDK versions):

    Paste the following code into the Awake() function of OVR/Scripts/OVRDevice.cs, just after the call to OVR_GetDistortionCoefficients():


    HResolution = 1280;
    VResolution = 800;
    HScreenSize = 0.14976f;
    VScreenSize = 0.0936f;
    EyeToScreenDistance = 0.041f;
    LensSeparationDistance = 0.064f;
    LeftEyeOffset = 0.032f;
    RightEyeOffset = 0.032f;
    ScreenVCenter = 0.0468f;
    DistK0 = 1f;
    DistK1 = 0.22f;
    DistK2 = 0.24f;
    DistK3 = 0f;

    Just remember to remove this code when actually using it with a Rift, just in case the SDK is changed in the future.

    I also use highlighting effect component which will display white outline on the selected object. Same with OVR lens correction, it uses render-to-texture to create the effect. The problem is it's not compatible with OVR lens correction. The outline will be rendered without the lens correction, causing it to have different shape compared to the highlighted object.

    My 2nd question is: How do I include OVR lens correction effect to another render-to-texture component?

    You generally want to make sure image effects take place before the lens correction so that the lens correction is the last thing that happens. The way the OVR prefabs are set up, they tend to kick any image effects to the end (which is not where you want them). boone188 pointed out a while back that this can easily be worked around by placing the image effect onto the 2 Rift cameras (CameraLeft and CameraRight) and moving the resulting image effect components up above both OVRCamera and OVRLensCorrection components (via right click -> Move Up), and then going up to the top of the inspector panel and hitting "Apply" so that the OVRCameraController/OVRPlayerController prefab doesn't try to restore the original order of the image effects.

    Hope that helped!