Sorry, but I am stuck again. The final goal is to have an AR scene with image tracker. The tracker marks the hole in the wall. Inside the wall I want to place other object with animations and so on. With your help I have finaly the hole but as I understand, the hole is more of an optical illusion, right? So it is not realy a hole in 3D space, where I could place other object.
@_Mike, the other way to think about this problem is a more simple, direct route of faking it. If you are in an AR space, you already have a texture from the camera feed to work with. If you create a separate piece of geometry that has a hole in it that is large enough to cover the open cube, you can just create a shader that applies the camera feed to it in screen space. That way you have geometry sorting out visibility of anything inside your open cube and can have multiple meshes inside the cube playing animation or whatever. You could also move meshes into an out of the open cube in real time making it appear that there really is a hole in the wall.
Other than the shader displaying the camera feed in screen space on the mesh, there is little overhead for this kind of approach. It’s fake, but it’s an inexpensive fake since you have a clean camera feed already and there is no need for additional render textures.
@Evgeni_Popov Maybe I did not understand your suggestion, but there is no real mesh to subtract from, as the “ground” is the real surface from the AR camera. I need to hide the cube (hole in the wall) from the side perspectives. Tricky
First - in XR units are in meters. so a hole the size of 4 units would mean 4 meters wide. That’s probably your entire device screen space, in this proximity.
Second - you missed 2 things from the original PG - first, the hole walls should be moved down, otherwise it looks odd (the walls are above the ground), and the second is setting the occluder to visibility 0.0001 - visible, but as little as possible. And a small note - making the occluder mesh only 5 by 5 will prevent the effect from working. Make it 50 by 50 or even more.
I added an arc rotate camera to the scene so you could see how it looks like before
Also note that you are setting the root position to be the position of the marker. I can only assume you are using the marker on the floor? Try first looking at the floor without a marker - you will notice it is working as expected already:
Thank you very @RaananW for your reply! I have to confess, that I still don’t get the occluder magic On the floor your PG works very well. Unfortunately I am trying to achieve the effect on a vertical wall. Using the tracking marker, the cube is place on the right place, but the effect breaks.
This of the occluder as a mesh that doesn’t render anything that is “deeper” that itself. Setting its visibility to 0.0001 make it almost transparent (or - transparent to the human eye? ). So this mesh will occlude everything that comes after, which is exactly what you are trying to achieve.
Now I think I understand the occluder magic, thank you for the explanation
I tried your updated PG with the rotated ground. Now standing right in front of the demo it looks like a hole in the wall. But looking from the side it still looks like the screenshot above. I it is possible, could you try your PG with the image marker, and see if it works? I am starting to feel crazy and annoying.
Oh, wow, that was a lot of fun . Took a little while, but a lot of fun nonetheless!
there are a few reasons for that - first, the occluder doesn’t have the root as a parent. Second, the scene needs to be prepared in 0 rotation and 0 position, if you want to just apply the transformation of the marker. Otherwise you will need to transform the scene correctly.