arfoundation-samples icon indicating copy to clipboard operation
arfoundation-samples copied to clipboard

How to make ARFeatheredPlane transparent?

Open Berenice2018 opened this issue 7 years ago • 4 comments

Hi all,

I want to make the ARFeatheredPlane invisible / transparent, but keep its Collider and other functionalities so that models can placed on that plane.

What I have tried so far is disabling the Renderer, but the planes are still rendered and it looks like their collider is not working anymore. I cannot move or place models on this plane:

arPlaneManager.GetAllPlanes(allPlanes);
            foreach (ARPlane arplane in allPlanes)
            {
                rend = arplane.GetComponent<MeshRenderer>();
                if (rend != null)
                {
                    rend.GetComponent<Renderer>().enabled = false;
                }
            }

Alternatively, how could I access the alpha channels of the Shader FeatheredPlaneMaterial? Even if I just print the shader name of the ARPlane, I cannot place models on that plane anymore.

arPlaneManager.GetAllPlanes(allPlanes);
            foreach (ARPlane arplane in allPlanes)
            {
                rend = arplane.GetComponent<MeshRenderer>();
                if (rend != null)
                {
                    debugBox.text += rend.material.shader.name;
                }
            }

Berenice2018 avatar Jan 28 '19 21:01 Berenice2018

Why are you trying to access through code ? You can access from project window, just find the material and make its alpha to zero. I use this way for 6 months and it works like charm.

mert-dev-acc avatar Jan 30 '19 17:01 mert-dev-acc

Thanks for your reply. I would like to access it through code, because I need to switch the ARPlanes' visibility dynamically/ at runtime, i.e. on and off on button click.

Berenice2018 avatar Jan 30 '19 20:01 Berenice2018

You can use different materials instead and rather then switching material values, you can simply replace plane material.

mert-dev-acc avatar Jan 30 '19 21:01 mert-dev-acc

Thank you @m3rt32 , That is the best workaround so far. After switching the materials two times, the feathered plane looses its fading contours, it has a hard cut contour. But, this is not that important.

Berenice2018 avatar Jan 31 '19 20:01 Berenice2018