- Home /
Phantom clipping
I would like to clip an object with a transparent wall like the wall was opaque. For example if the wall is opaque and half of the object is behind the wall, that part is not visible. I would have similar clipping even though the wall is transparent.
Attached picture illustrates what I am looking for. The "green box" is the transparent (or invisible) wall and the sphere is clipped.
This could be achieved by writing the invisible wall to the z-buffer and then compare it to the z-value of the sphere. On fragment shader, if the z-value of the sphere is behind the z-value of the wall, that fragment's alpha is set to 0. Nevertheless I do not know how this could be implemented. Any help? Also if there is a smarter way to do this, I would like to know.
http://docs.unity3d.com/Documentation/$$anonymous$$anual/OcclusionCulling.html
But this is Pro only. Its the idea and the name of the procedure you need to know.
Answer by aldonaletto · Aug 07, 2013 at 12:46 PM
You could use a "depth mask", an object rendered with a special shader that doesn't actually paint a single pixel - it just sets the depth buffer accordingly. This disallows rendering behind the object, making it a kind of "invisibility mask". Take a look at this question to get more details.
Your answer
Follow this Question
Related Questions
Is it possible to z-order triangles with transparency? 1 Answer
Hiding sections of arbitrary models that lie one side of a plane 0 Answers
What's the difference in z sorting transparent vs diffuse 0 Answers
Transparency or Alpha Channel for Cinema 4D Materials? 1 Answer
Alpha Channel & Specular image problem 0 Answers