in my AR application I want to render a model on top over another. Is there any method or variable to influence this?
in my AR application I want to render a model on top over another. Is there any method or variable to influence this?
Yes,there are at least two options:
alwaysthis has to be set on the shader of the materal your model is using. Here's the documentation from unity, but there are also some guides online how to write a shader with custom z-test.
This is done by having two cameras. One is your ARCamera and a second one that always at the same pose as the ARCamera. This could for example be done by setting the 2nd camera as a child of the ARCamera with Identity Pose. Then you can create a special Layer for example "Always In Front" and assign the model to it. Then set the cullings Masks accordingly for both cameras such that the 2nd camera only renders the model and the ARCamera only everything else. There might be some overhead when rendering two cameras with this solution.
Your problem has a similar solution to preventing weapons clipping in FPS games. As seen in this blogpost .