We are experiencing some issues with a custom hologram shader we made. When we test the shader on pc everything is ok and the other 3D elements in the scene render in front of the mesh of the shader. Since it is a mobile AR experience we tested it out on mobile and there the 3D object is rendered behind the hologram shader. Are there any fixes for this? (f.e. depth testing in shaders?)
We are currently using ZapWorks to create our AR experience.
Sadly we can’t share the official project since it’s confidential, but we can share the shader project itself: PlayCanvas 3D HTML5 Game Engine
If you test this project on mobile there seems to be no problem (non AR environment), I think the AR environment does something with the shader render order and messes it up.
I’ve checked with my boss and since the devices have already been revealed I can put the project online for some time (later I willl put it on private again). If you test this on mobile and choose the menu option “Body Composition” you will see the shader here, but the text and watch are actually in front of the shader but show behind.
Maybe @mvaligursky or @Leonidas have some initial ideas. It could be related to layers or it looks like the depth buffer isn’t cleared for the UI layer
A bit of a delayed response, apologies (Monday was a public holiday here) :
@yaustar The UI text element seems to get rendered behind the model if you disable bloom pass on the minimal example you’ve shared. Here’s a fork showing that: https://playcanvas.com/editor/scene/1221911
Looks like @DampedFred’s AR camera has bloom toggled off - which results in the render order issue.
Not sure. When we render without bloom or any other post-effects, we would likely render to backbuffer directly, which would have a depth buffer which gets rendered to as well.
When bloom is enabled, the scene would be rendered to texture with a depth buffer … and then the texture would get post-processed and copied into framebuffer. Which means at the end the depth framebuffer when bloom is enabled would not be filled in.
So maybe that SDK somehow does not use correct depth buffer or something.