MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Mixed Reality Camera Prefab HoloLens Performance

Open StephenHodgson opened this issue 8 years ago • 15 comments

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

  1. Make a build with a simple camera and a FPS counter and view stats
  2. Make a build with the Mixed Reality Camera Prefab and view stats.
  3. Compare results.

Mixed Reality Toolkit Release Version

Current.

StephenHodgson avatar Jan 20 '18 23:01 StephenHodgson

I came here to write this. Recently updated my old holotoolkit to MRTK and realized performance is suffering on hololens...

firativerson avatar Jan 22 '18 14:01 firativerson

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.

SimonDarksideJ avatar Jan 23 '18 09:01 SimonDarksideJ

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)

brean avatar Jan 23 '18 14:01 brean

What exactly is causing the bad performance? I feel like this shouldn't be an issue if we properly remove the components.

Zod- avatar Jan 24 '18 14:01 Zod-

That's the problem, we shouldn't have to be removing components. Only adding additional components if needed.

StephenHodgson avatar Jan 24 '18 16:01 StephenHodgson

@brean, I think keeping to a single prefab keeps things simple for devs who just want to get started quickly.

StephenHodgson avatar Jan 24 '18 16:01 StephenHodgson

How do you determine what has to be removed/added anyway?

Zod- avatar Jan 24 '18 16:01 Zod-

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.

SimonDarksideJ avatar Jan 24 '18 16:01 SimonDarksideJ

I will investigate today why there is bad performance and report back what I find.

NeerajW avatar Jan 25 '18 18:01 NeerajW

One issue was the allocations for the uGUI raycasting but I fixed that already.

StephenHodgson avatar Jan 25 '18 18:01 StephenHodgson

Here's what I saw using Windows Device Portal for fps:

  1. Basic cube with MixedRealityCamera.prefab = 60 fps
  2. Basic cube with MixedRealityCameraParent.prefab = 60 fps
  3. Basic cube with MixedRealtiyCameraParent.prefab + InputManager.prefab = 60 fps
  4. 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.

NeerajW avatar Jan 25 '18 19:01 NeerajW

What about with uGUI elements in the scene?

StephenHodgson avatar Jan 25 '18 19:01 StephenHodgson

I think I fixed most of the FPS perf in https://github.com/Microsoft/MixedRealityToolkit-Unity/pull/1608

StephenHodgson avatar Jan 25 '18 19:01 StephenHodgson

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.

StephenHodgson avatar Jan 31 '18 18:01 StephenHodgson

will address in vNEXT

StephenHodgson avatar May 17 '18 16:05 StephenHodgson