Forum Discussion
borutwm
11 years agoHonored Guest
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
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
- cyberealityGrand ChampionHmm... that sounds like it could be a bug. Let me see if there is any reason we have to do that.
- sh0v0rProtege
"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. - vrdavebOculus StaffIt'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.
- borutwmHonored GuestAwesome - 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)
- drashHeroic ExplorerThis 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!
- vrdavebOculus StaffJust 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.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 months ago
- 9 months ago
- 3 months ago
- 1 month ago