RealityView attachment draw order

My visionOS 26.3 app displays a diorama-like scene in a RealityView in a mixed immersive space, about 1 meter square, with view attachments floating above the scene.

Each view attachment fades out after user interaction, by animating the view's opacity.

What I'm observing is that depending on the position of a view attachment relative to the scene and the camera, an unwanted cutout effect is observed (presumably because of draw order issues), as shown in the right column in the screenshots below.

YouTube video link of these sequences: https://youtu.be/oTuo0okKCkc (19 seconds)

My question:

How does visionOS determine the view attachment draw order relative to the RealityView scene?

If I better understood how the draw order is determined, I could modify my scene to ensure that the view attachments were always drawn after the scene, fixing the unwanted cutout effect.

I've successfully used ModelSortGroupComponent to control the draw order of entities within the RealityView scene, but my understanding is that this approach cannot be used with view attachments.

I've submitted FB22014370 about this issue.

Thank you.

Hey  @drewolbrich,

Thanks for filing this feedback. I wasn't able to replicate your experience, but I'm curious if you get the same result by replacing opacity(_:) with OpacityComponent?

Additionally, have you considered applying a subtle breakthrough effect on your views? This might mitigate the issue and could improve things if you expect your views to collide your content.

Are you able to replicate this behavior in a sample project that we could take a look at? Feel free to link it publicly here, or you can privately share any project with us in your Feedback Request. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

Thanks,
Michael

Hi @Vision Pro Engineer

I've created a sample app and attached it to FB22014370.

The sample app contains a README file with repro steps and a description of the issue.

I initially created a simpler sample app, and in that app, the issue could actually be fixed using breakthroughEffect as you suggested. (Incidentally, breakthroughEffect does not appear to fix the issue in the simulator.)

However, in the actual app I'm working on, breakthroughEffect surprisingly did not solve the problem, and the cutout effect was still visible in that app.

Through trial and error, I discovered that breakthroughEffect does not appear to help for scenes that use ModelSortGroupComponent and which also contain more than one ModelEntity with ModelSortGroupComponent assigned, and for which view attachments are positioned beyond the center point of the bounding box of model entities with the shared ModelSortGroup, from the perspective of the camera.

This scenario is demonstrated in the sample app.

In the sample app's README file, I've also included specific questions about the behavior of transparent view attachments when used with scenes that use ModelSortGroupComponent.

I tried your OpacityComponent suggestion and the view attachment draw order I observed was the same as when I used the opacity view modifier.

I appreciate any assistance you can provide to help address the unwanted cutout effect issue.

RealityView attachment draw order
 
 
Q