Problem / Bug at Zview Augmented Reality Mode when using Tranparency

0 votes
asked Jul 3 by _V3_ (14 points)
I'm using Unity 5.6.4 with ZCore version 5.0.0 (Runtime version: 4.0.3) with ZView version 5.0.0 (Runtime version: 4.0.2)
I enabled Transparency in zView because I need to use transparent shader for objects. Everything work perfectly on ZSpace screen, so on ZView screen with Standard Mode but not in ZView screen with Augmented Reality Mode. In MainCamera, if I enable "Allow HDR" option, zView will display double layers, one is Standard Mode, one is Augmented Reality Mode. If i disable "Allow HDR" option, zView will not clear frame in Webcam render area.
Please show me how to fix it.
*Note that : Everything worked on ZCore version 4.0.0 (Runtime version: 4.0.3) with ZView version 4.0.0 (Runtime version: 4.0.2), and Camera disable "Allow HDR" option.
commented Jul 4 by _V3_ (14 points)
Update: I magaged to fix it by replace some script in VirtuaCameraAR and shader CompositorRGBA
commented Jul 5 by AlexShorey (265 points)
Hi _V3_,

I'm glad to hear you found a fix for your issue. I wasn't able to reproduce on my end. We're always on the look-out for fixes/improvements for future releases. If you happen to have a spare moment, we'd love hear some more detail about your solution!

Alex S.

1 Answer

0 votes
answered Aug 13 by _V3_ (14 points)

Sorry for the late reply,
Actually, my problem is VR camera renders a white background with non-environment objects. This make transparent objects got problem when dragged to webcam area . I did a small change in VirtualCameraAR and CompositorRGBA shader so that camera don't render the background
*** VirtualCameraAR.cs: set only _compositorCamera.cullingMask when render non-environment objs

        private void RenderRGBA(ZView zView)
        {        

                =======================================

                // Render all non-environment objects including the box mask.
                _secondaryCamera.clearFlags = CameraClearFlags.Skybox;
                _secondaryCamera.backgroundColor = MASK_COLOR;
                _secondaryCamera.cullingMask = _compositorCamera.cullingMask ;
                _secondaryCamera.targetTexture = _nonEnvironmentRenderTexture;
                _secondaryCamera.Render();

                 =======================================
        }

***  CompositorRGBA.shader : set mainColor alpha is 1 when maskDepth = 1

        float4 depthMask(v2f pixelData) : COLOR0
        {
            float maskDepth = DecodeFloatRGBA(tex2D(_MaskDepthTexture, pixelData.uv));
            float4 mainColor = tex2D(_MainTex, pixelData.uv);
            float4 nonEnvironmentColor = tex2D(_NonEnvironmentTexture, pixelData.uv);

            if (maskDepth < 0.999)
            {
                return nonEnvironmentColor;
            }
            else
            {
                mainColor.a = 1;
                return mainColor;
            }
        }

...