Forum Discussion

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

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

6 Replies

Replies have been turned off for this discussion
  • Hmm... that sounds like it could be a bug. Let me see if there is any reason we have to do that.
  • "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.
  • 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.
  • borutwm's avatar
    borutwm
    Honored Guest
    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)
  • drash's avatar
    drash
    Heroic Explorer
    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!
  • 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.