Skip to main content
Up and Coming
June 16, 2014

Poor performance when animating basic camera parameters

Related to this thread: viewtopic.php?f=37&t=8334&p=114396&hilit=memory#p114396

We're animating the clip plane on the camera (in connection with a fog change in the environment), and performance tanks because of the (seemingly unnecessary??) work in OVRDistortionCamera.GenerateMesh. I've removed the clearly unneeded extra array allocations for verts, indices, etc (only allocate them when the mesh size changes), because that creates a large amount of per frame garbage which then frequently triggers the garbage collector. But there's still underlying OVR_GenerateDistortionMesh/OVR_DestroyDistortionMesh that I'm more hesitant to change.

It seems like the distortion mesh is generated upon any camera param change, but looking at the code my guess is that it's only necessary to change based on FOV/resolution changes? Is that correct? If so can this be fixed in the next SDK version?

Thanks,
Borut
    This topic has been closed for replies.

    6 replies

    Inspiring
    June 16, 2014
    Hmm... that sounds like it could be a bug. Let me see if there is any reason we have to do that.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    sh0v0r
    Up and Coming
    June 16, 2014
    "cybereality" wrote:
    Hmm... that sounds like it could be a bug. Let me see if there is any reason we have to do that.


    I haven't tried this myself yet but I am very interested to know what the outcome is because Lunar Flight dynamically adjusts the far clipping plane during dust storms on Mars.
    Inspiring
    June 16, 2014
    It's not necessary to regenerate the distortion meshes when the clipping planes or background color change. I've made the necessary changes on our end and it should be fixed in the next release. In the meantime, you could split the "UpdateCamerasDirtyFlag" in OVRCameraController.cs. The above 3 settings can use a separate dirty flag from the rest.
    borutwmAuthor
    Up and Coming
    June 16, 2014
    Awesome - for clarification you mention 3 settings don't need updating, but only listed clipping planes and background color. Is there a third or was that a typo? (ie Is that the full set of things that don't effect the distortion mesh)
    Inspiring
    June 16, 2014
    This is awesome, vrdaveb. I want to let you know that your active involvement with the devs has been amazing ever since you showed up on the forums. Thank you!
    Titans of Space PLUS for Quest is now available on DrashVR.com
    Inspiring
    June 17, 2014
    Just referring to the background color, near clip plane, and far clip plane. Technically the distortion mesh doesn't depend on the neck or eye positions either.