trying to use a material with a shader as an hider material. The object should cover the object behind it and the camera image should be visible.
Often used on portals or on your smartphone.
Unfortunately it doesn’t work for me. Android and IOS simply show the object in white.
It looks correct in the Unity Scene. It is black in the game window and white in AR mode on the smartphone.
My material has a DepthMask and the material has the Export Lable
Hello there – we have an experimental AI bot that might be able to help you with your question. Would you like to try this out?
How it works:
Reply to the messages of the bot that end with a thread_id to interact with it and ask follow-up questions. You can also mention the bot directly in this channel to get help.
It sounds like the issue you’re encountering is with the shader and material setup for rendering AR content where a virtual object should serve as a mask to display the camera feed, commonly known as an “hider” material.
To troubleshoot the problem, consider the following steps:
Ensure the shader supports AR rendering and is correctly set up to display the camera’s background texture through the objects it’s applied to.
Verify if your shader and material settings are being preserved during the export process from Unity to your Android and iOS devices. If there’s an issue with the shader not being compatible with mobile platforms, it might show up as a default white material.
When using Needle Engine, ensure that the material’s settings, particularly those that refer to depth and stencil buffers, are correctly configured for web rendering, as there might be differences between the Unity Editor and the web runtime environment.
Confirm that the Export Label for your material is properly set so that Needle Engine recognizes it and includes it correctly in the exported project.
Since you mentioned the issue does not occur in the Unity scene or game window but manifests on the smartphone in AR mode, it’s very likely the problem is tied to platform-specific shader compatibility or incorrect material settings for web/AR environments.
Normally, checking the log output on your smartphone when running the AR session might provide more insights and error messages that can guide further investigation.
If there is a more specific question or if you have a code snippet or error message you’d like assistance with, please provide further details so I can offer more targeted help.
If the unity game window looks wrong already it will most likely not magically work in the exported scene.
I think what you’re trying to do here is creating a occluder and not a stencil effect. What you could use for the web is add a shadow catcher component and set it to occluder for this