cancel
Showing results for 
Search instead for 
Did you mean: 

[Bug] Poor performance of Oculus Interaction SDK ProcessCandidate and Postprocess

lufinkey
Protege

I've been using the oculus interaction SDK for a while and I've run across a lot of performance issues. We now have our own custom interactors built to solve most of the performance issues, but a lot of them can't be solved without replacing large parts of the interaction SDK. A lot of them can only be solved with reflection (if we want to still depend on the oculus interaction SDK)

1)  ProcessCandidate is slow for pretty much every type of interactor. The cause is due to InteractableRegistry (more specifically InteractableSet) looping through every registered interactable in the scene during the List method. We managed to partially solve it by making a custom derived class from InteractableRegistry and using reflection to modify the _data property of InteractableSet to a much smaller list of only the colliding interactables. However, the Include method still adds a lot of overhead, especially because all the InteractorFilters and InteractableFilters lists are looped using foreach() instead of for(). In some cases reducing the iterations in InteractableSet was enough to reduce overhead, but unfortunately a lot of the implementations of IGrabSurface are quite heavy, so even calculating the grab offset for a few candidates each frame adds a ton of overhead. We partially also resolved this by having an option on the interactable to cache "scoring poses", so the grab pose calculation could be completely skipped if the cached pose didn't score better than the current "best" pose. However this mostly only really works if you're only scoring based only on position (the built-in scoring also has some issues and calculates everything from the wrist, so we ended up having to mostly replace this too)

2) PokeInteractor.Postprocess loops through all PokeInteractables in the scene, which adds a lot of overhead. The most difficult part of this is that there's almost no way to reduce this besides making another custom interactor to replace PokeInteractor. We also have 2 poke interactors per hand for separate types of interactions (and we use IGameObjectFilter to filter candidates to the correct interactors/interactables) but both PokeInteractors loop through every PokeInteractable in the scene, even ones that are filtered with an IGameObjectFilter

3) ProcessCandidate and Postprocess get run multiple times per frame, which dramatically increases the overhead that they cause. In order to fix this, we had to make a custom BestHoverInteractorGroup and override/replace the Drive method with one that only runs ProcessCandidate once per frame, unless Unselect was called during one of the iterations. I know MaxIterations can be decreased, but this causes other issues and makes interactions less responsive.

 

Hopefully someone has found a better solution to these issues. Also if anyone is interested in our custom classes that partially fix many of these issues, feel free to let me know and I'll post them!

 

6 REPLIES 6

lufinkey
Protege

One other thing I forgot to mention is that when you have separate PokeInteractors for hand tracking and controllers, they both seem to run logic every frame unless you add the PokeInteractor as an entry to the ActiveStateTracker script

That's invaluable info, thanks for sharing your findings. Although you'll probably not get a direct reply from Meta engineers, I've been told that relevant posts like this do get forwarded on to them and triaged. I used to find that lack of response extremely frustrating but it's just because they're busy. Please do keep reporting these kinds of issues.

Big_Flex
Expert Protege

Hi @lufinkey, thanks for posting this feedback! It's very helpful. I'm on the Interaction SDK team, so I'll pass this info to the engineers. 

lufinkey
Protege

That's fantastic news, thank you! If you or any of them are interested, I'd love to take them through our other modifications to the Interaction SDK. I think they significantly improve usability!

Happy to help--I've passed your offer along! In future Interaction SDK posts on the VR forum, feel free to tag me directly so we can help.

I've talked with the team and they want to take you up on that offer! Just sent you a DM.