Hi,
So I’m looking for a way to have meshes gettings clipped by walls and furniture in AR.
Using Meta API and OpenXR, I can retrieve the geometry of real world items. I can then create meshes that will be displayed (works well)
However, I don’t want them to be displayed using an opaque material, as it obfuscate the real world camera.
I only want them to somehow write their depth in the depth-buffer prior to any other mesh being rendered, so that other drawn meshes will appear to be hidden behind (walls, tables)
In WebXR, my approach was : start by rendering AR walls using a shader that output a fully transparent value in the color buffer (but write the depth buffer), then render Opaque, then Transparent meshes as any engine does.
Yessir, just create a custom shader with “shadow_to_opacity” turned on. If you use the compatibility renderer its best to use it as an unshaded material as the multipass shadow approach doesn’t allow you to make use of the shadow casting feature, but with the mobile renderer you can create an effect where virtual objects can cast shadows on your real environment (hence the name).
I think thats a bug that was fixed some time ago, maybe it wasn’t cherry picked for 4.4.1. You could try it in the latest 4.5 dev built (make sure you backup your project JIC).