I’m building a Mixed Reality App and I have an issue or something I don’t quite understand.
I’m creating a scene where the player will be entirely in the dark. However, when virtual objects come into contact with real objects, passthrough appears around my virtual objects.
I don’t want to use the “Reality Kit Immersion Style: Full” mode because I’m using a transparent sphere as a skybox, and I reduce its opacity to create transitions between full black and passthrough.
How can I prevent these zones from appearing (highlighted in red in my screenshot)?
Hi there! Sorry to hear that you’re having trouble.
It looks like you’re hitting the same issue as folks in this thread. In fact, I ended up adding a shader to the visionOS sample with the same problem! There’s a more thorough explanation in the post that I linked, but the issue is that transparent textures using the default blending mode end up writing alpha values to the final framebuffer, which causes passthrough to “leak” through. If you use Blend SrcAlpha OneMinusSrcAlpha, SrcAlpha DstAlpha in the offending shader, you should see this issue go away. Finding which shader is doing it can be tricky, but it looks like there’s a feathered edge somewhere in that UI panel that uses alpha.
I am attaching 2 photos to my post.
The first shows that the 3D suitcase is not in contact with any real object; it is floating in the air.
In the second, the 3D suitcase is in contact with my table.
This seems more like a native headset feature to prevent the player from bumping into objects… especially since, when I stay still, the passthrough turns completely black again.
I tried changing the shaders to Unlit Transparent, Lit Transparent, Simple Lit Opaque, and Lit Opaque… with exactly the same result.
Perhaps a solution would be to change the Reality Kit Immersion Style to “Full” at runtime. Is it possible?
Hey there! First off, my bad. The post I linked you to only applies to Metal rendering. I got your question confused with another one which mentioned Hybrid mode, so I thought maybe you were seeing these issues with a Metal CompositorLayer. The blend settings for a RealityKit material won’t have the same effect.
Hm… There are some features to enable you to see other people and I think your computer, so that would make some sense. If that’s the case, there’s nothing you can do about it.
Technically, yes. It’s possible to change the immersion style at runtime, but it’s not something we support. It’s not quite as straightforward as just calling a normal API, so we didn’t include the ability to change at runtime in the initial scope of the immersion style setting. If you set the immersion style to full, (ignoring the fact that you also want passthrough sometimes) does the issue go away? If so, this is something we might consider implementing, since you’ve demonstrated a pretty compelling use-case. And in that case, please submit it as an “idea” on our roadmap so we can consider it for future releases.
Yes, absolutely. When I’m in Immersion Style: Full, the issue goes away, and the passthrough doesn’t appear around my 3D objects when I move my head.
However, I’m sure there’s something that can be done because I have another scene that’s much more complex, with many large objects taking up a lot of space and surrounding us, and in that scene, I don’t see the passthrough. This problem only occurs with small objects in an empty scene.
I’ll keep looking on my end and will come back here when I find a solution, as this is a very important feature for my project.
If you have any ideas or additional information, I’d be happy to hear them
In any case, I’ll submit an idea to add this to your roadmap.
Sounds good! As always, we’re best able to help if we can reproduce the issue locally. Even if you can make a new project with just a few objects and all of the settings necessary to replicate the issue, that would be a big help. It can also help with the troubleshooting process if you start fresh and gradually build up to the issue, testing at every step. That way you can be sure the last thing you did is what causes the issue.
I pushed a minimal project to reproduce the bug: a simple scene with lots of cubes around us. When the cubes come into contact with real objects, the passthrough activates around my objects.
If you have time to take a look and tell me if it’s possible to remove this behavior, I would be delighted. As a reminder, I don’t want to enable “Reality Kit Immersion Style: Full” because, in my project, I have other scenes where the passthrough is 100% active.
Don’t pay attention to the name of the Git repo, it’s an old project I had pushed to flag another bug that has since been resolved. I’m just recycling my repos, hehe.
I found a solution — a bit crappy, but a solution nonetheless.
I added large cubes with a black Unlit shader behind my objects.
Surprisingly, it doesn’t work if I use planes or quads with the same material.