I was attempting to write a script that would turn the mesh renderers off if they are behind a vertical surface with AR kit 1.5. I tried to do this by taking all the game objects in the scene that didn’t have a tag “Plane”. Then got the direction from the camera to the object, I would cast a ray from the camera towards the current object. If it hit anything other than the current object, in this case vertical planes, it would disable the mesh renderer. Didn’t work as expected so after looking into it and looking for other people that has successfully done this, I found some videos about geometric occlusion and that unity has a example scene of it. Works perfectly, I just can’t figure out how to do it on my own objects. I finally found a occlusion slot in the material that is on the doll. I also found a occlusion material and a shader. So my question is what components do I need to make my objects work like the doll?
You just make the plane prefabs use the occlusion material (e.g use the occlusionPrefab) and then virtual objects on the other side of it will not be rendered.
The actual planes or the objects that need occlusion?
Oh I understand now I didn’t realize it was a gameobject
And? Did you get it? Im trying to make my virtual walls hide between real objects but can’t get it. I only found occlusionPlanePrefab. And material but it doesn’t seem to work. I tried OcclusionArea to be places where my wall is. Also making object static but you can’t bake them in real time while running application, any help please?
On the script that places debug planes onto surfaces you change the debug plane to the occlusion plane prefab.
And thats it? Now i will be able to put it behind real world objects? Nothing about setting some occlusion culling, camera settings and stuff? You mean changing the blue box generated on walls into the occlusion one? Will check in a moment
Yep the kinda annoying thing is you can’t see where it picks up a surface it’s invisible. Maybe make a button to change all surfaces to debug planes and vice versa.
Well now it just created big pink box as you said then i place on it my own virtual object and still it goes front all of real objects. Chairs, sofas, tv’s everything is in front and no occlusion there is. Am i missing something?
On your “Unity AR Generate Plane” script change the Plane Prefab to occlusionPlanePrefab. Not on the object just in the script… now if you find a table and let it find a surface on the floor under the table then put your object on that surface so that it’s under the table. Then find a surface on top of the table. Now when you look down at the object through the table it should disappear.