- Home /
Opacity at Runtime - Fade Shader
Hi everyone,
I want to manage the opacity of an object. For this, I have a Transparent Shader with the "#pragma alpha" component to dynamically changing object's opacity at runtime.
The problem is that the Fade Shader of Unity has a big bug because of the Z-Depth. Some parts of my objects are put on the top of the others...it's sooooo awful. I Have some artefacts so.
Artefacts
To solve this, I can use ZWrite On tag form the shader.
In another hand, I want to cut this object so I use the "clip()" method in my shader to discard some pixels. But if I use ZWrite On, I have some new artefacts, pixels are with a null opacity but always here... :'(
ZWrite On, and Clip
I work on this problem since few days and I don't find anything to help me. I have 2 solutions but no idea how doing them. -Find an other way to managing opacity without "#pragma alpha" -Find a method to delete completly the pixel after he was discard by the clip method.
Any idea, how I can do this ?