Depth mask on objects without disabling AR video background rendering

0 votes
asked Oct 29, 2019 by fokslab (200 points)
Hi,

I wrote quickly a depth mask shader and when I apply it on some objects the AR video background applied on the camera is disappearing. Have you got some advises to fix this issue ? The shader is basically rendering the object only writing the Z values (without writing the color values using a 0 ColorMask ). Should I set a specific render queue value ?

Regards

2 Answers

0 votes
answered Oct 29, 2019 by fokslab (200 points)
that was it, chaging the render queue value fixed everything (I answered my own question :) ).

Maybe that will help someone !
commented Nov 15, 2019 by jeffreyshawkins (180 points)
We have tried several depth mask shaders and changed the render queue to transparent and are not getting the occlusion. Can you help?
commented Nov 17, 2019 by fokslab (200 points)
Try to put put the queue value before geometry it should be rendered before all other objects (geometry) to hide them
commented Nov 18, 2019 by jeffreyshawkins (180 points)
Sorry. Still kind of a newbie. What queue value should I put the Depth mask and what queue value should i put the background?
0 votes
answered Mar 4 by jeffreyshawkins (180 points)
Do you mind sharing the shader? I am still running into issues with EasyAR and occlusion.
commented Mar 5 by fokslab (200 points)
When you setup the material of your depth mask object (in the inspector)  you can see "Render Queue" property, try putting it th earlier as possible ("From Shader / 0" for instance should work), this will mean that the object is rendered before any other object and writes the depth mask (in the ZBuffer) that will be used to occlude the others.
If modifying the render queue does not work it may be because of the shader you used. Try to find one in forums ( https://wiki.unity3d.com/index.php/DepthMask for instance, but with a script to manage the render queue, not really interesting for most of the case, you should set the render queue value directly on your depth mask with the minimum value in the scene)
commented Mar 5 by jeffreyshawkins (180 points)
Thank you. Unfortunately, it didn't work and I used several depth shaders. But, thank you.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...