Closed valantano closed 1 year ago
Just to start by answering some questions here:
Something I noticed is that the declaration for textureCoordQuad
is not declared in the right scope for the vertex shader. You could try redeclaring the varying vec2 above the main function in Vertex.
First, the first pass in the subshader is used to minimize the overdraw in the AfterOpaques
rendering scenario when occlusion is also enabled. Basically, since all scene content has been rendered prior to background rendering, AR Foundation needs to determine where to render the background over the geometry that has been rendered and the easiest way to accomplish this is to compare the depth buffer against the environment depth value for that pixel and if the environment depth is in front of the geometry then overwrite that pixel color with the camera background.
Duplicate of #1017. A fix has been implemented for this issue. See https://github.com/Unity-Technologies/arfoundation-samples/issues/1017#issuecomment-1453782949 and https://github.com/Unity-Technologies/arfoundation-samples/issues/1017#issuecomment-1559356323.
Hello Guys,
I am working on a project in AR Foundation in which I need to create my own Occlusion Shader. Below is a modified copy of the Unlit/ARCoreBackground/AfterOpaques Shader which is provided by the Google ARCore XR Plugin (v.5.0.2). I did not touch the first pass but only the second. But there is a problem in the first pass: textureCoordQuad does not work properly (if I use it the texture gets pink). I actually don't know what the first pass is doing or if it is even working. However in the second pass I am able to get the CameraDepthTexture as Background texture (the texture which would normally contain the camera image), but since textureCoordQuad is not working I can only use the textureCoord of the EnvironmentTexture which is why the Depth Texture is not correctly displayed. Can someone please help me with this shader? How do I work around the textureCoordQuad problem to get the textureCoords for the CameraDepthTexture? And maybe someone can tell me what the first pass is supposed to do. Maybe someone has a good tutorial available? I know how vertex and fragment shader work, but I am not deep into OpenGLES3 shader but sadly the default Unlit shader of Unity don't seem to work on Android, although it is said that they would be converted automatically and although on the AR Foundation Website there is a pseudocode example: https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.0/manual/migration-guide-5-x.html
Thanks in advance.