In our Polyspatial scene we have multiple worldspace UI Canvases. Most of them are not static meaning they either have a LazyFollow on them or can be moved manually by the user. Also most of them have a lot of elements with transparency.
We noticed a significant drop in framerate when 2 canvases are overlayed. Also sometimes there is a graphic bug where the one that is further away appears on top of the closer one.
Trying to improve this situation, I tried using the VisionOSSortingGroup Component. I added each parent Canvas as a Renderer, checked ApplyToDescendants for each of them, and assigned all of them a different sorting order. But now, the elements within one renderer group are flickering back and forth on top and over eachother. More precisely, the elements that all have the same sorting order dont seem to respect the UI structure rendering order ; images that are children of other sometimes appear underneath them, and it flickers like that. I will try to add a video of the behavior later.
My guess is that I have the wrong approach with the VisionOSSortingGroup Component. Is it useful for what i am trying to fix (rendering order issue and performance) ?
How can I use this component properly ?
This is expected; if you don’t use the VisionOSSortingGroup component, we use a custom sorting group for UI components that reproduces the sorting behavior from Unity (which I believe includes the ordering in the scene graph). Using the VisionOSSortingGroup component overrides that behavior, and everything in the same group/order will not (AFAIK) be sorted in any predictable way; at least, the documentation for ModelSortGroupComponent doesn’t specify how entities are sorted within the same order.
I suspect we could potentially add a mode where, for example, order values are generated on the fly (with a given starting value) according to the UI structure. It’s worth submitting that as a suggestion to our road map, but in the meantime, you might have to generate the order values yourself at runtime using one Renderer entry per CanvasRenderer (rather than just using one for the entire Canvas).
As for the performance issues, that’s news to me, but it seems likely to be an issue on Apple’s end (that is, we don’t do anything special or even detect when canvases are overlayed on top of one another). I’d suggest submitting feedback to them about the issue.