Mixed Reality Camera Prefab HoloLens Performance
Overview
It's been brought to my attention that the Mixed Reality Camera Prefab's performance on the HoloLens suffers considerably because of the extra Components and Requirements for the Immersive Headsets.
Perhaps we should instead engineer the Mixed Reality Camera Prefab with only the needed components and add them if we're on a higher end machine for the Immersive Headsets.
Currently we remove the components if they're not required, which is inefficient.
Steps to reproduce
- Make a build with a simple camera and a FPS counter and view stats
- Make a build with the Mixed Reality Camera Prefab and view stats.
- Compare results.
Mixed Reality Toolkit Release Version
Current.
I came here to write this. Recently updated my old holotoolkit to MRTK and realized performance is suffering on hololens...
The trick here is that we obviously don't want a separate camera prefab for HL & Immersive. SO I guess we need to have detection code which will enable / disable the relevant components that are not required.
Trick will be whether that's enough for Unity.
The trick here is that we obviously don't want a separate camera prefab for HL & Immersive.
What about having 2 prefabs for HL & immersive and a 3rd prefab with a script that adds one of the other two according to a user selection? (Switching between the prefabs triggered by changes in the inspector using the OnValidate-function)
What exactly is causing the bad performance? I feel like this shouldn't be an issue if we properly remove the components.
That's the problem, we shouldn't have to be removing components. Only adding additional components if needed.
@brean, I think keeping to a single prefab keeps things simple for devs who just want to get started quickly.
How do you determine what has to be removed/added anyway?
We need to keep it a single Prefab / manager to ensure cross-compatibility. Especially as we move to a multi-vr approach for the framework. I agree, there should be sub-components for each platform (just HL/Immersive for now) that are enabled / disabled / added / removed depending on the runtime.
I will investigate today why there is bad performance and report back what I find.
One issue was the allocations for the uGUI raycasting but I fixed that already.
Here's what I saw using Windows Device Portal for fps:
- Basic cube with MixedRealityCamera.prefab = 60 fps
- Basic cube with MixedRealityCameraParent.prefab = 60 fps
- Basic cube with MixedRealtiyCameraParent.prefab + InputManager.prefab = 60 fps
- Basic cube with MixedRealtiyCameraParent.prefab + InputManager.prefab + DefaultCursor.prefab = 60 fps
So I know the basics are working right. Not sure if there is other context for repro.
What about with uGUI elements in the scene?
I think I fixed most of the FPS perf in https://github.com/Microsoft/MixedRealityToolkit-Unity/pull/1608
I still think it's worth going in and updating the prefab to add components as needed instead of destroying what we don't need.
will address in vNEXT