Stencil Support in PolySpatial

Can we have stencil support in PolySpatial?
I’m adding stencil on top of the supported shader (for example, the basic lit URP shader graph)
Stencil{
ref 1
comp always
pass replace
}
and couldn’t able to get the shader rendered.

Is stencil in general not supported or is there any way around to get stencil effect?

Thanks.

Unfortunately, no, there is no support for stencil buffer operations in visionOS’s MaterialX support.

Is there another way to achieve this effect? I noticed the game Synth Riders on Apple Vision Pro accomplished this.

You can create geometry and apply an occlusion shader to it.



Thanks for the support, Dan! I’m relieved and excited that there is a way to get this effect done. I’m unfamiliar with occlusion shaders. Is there anyway you can explain / show me how you did this with this geometry example?

It’s a built-in material type that ships with Unity, if you change the shader of any material and then apply it to the geometry it will occlude all virtual content hidden by the occlusion geometry.


1 Like

Any update on this? it is still not supported?

If you mean support for stencil operations in MR, then no, it is still not available. This is a limitation of Apple’s RealityKit, which does not provide any support for stencil operations. If you are interested in such support, I suggest you request it from Apple via their Feedback Assistant.

1 Like

Hello, i’m trying to achieve exactly this, but I’m missing something …

Can you explain to me a little deeply which object get which shader ?

Maybe can you send a zip file of the project ?

Thanks you very much

I created a sphere with a hole and applied the occlusion shader to that. That will occlude all the content that is behind the sphere geometery except the hole.

Can you share a little bit about what you are trying to achieve?