Hide Objects with a clipping volume or plane?

I am trying to clip out an object from the Main Camera from a certain vantage point only. I have attached a project with a simple ping pong animation on the main camera. What I am trying to accomplish is simple:

I wish to be able to see down into the chute when the camera is at its top most position, however, I do not wish to see inside the chute when the camera is at its lowest position. I have tried occlusion culling with planes and volumes and masking shaders on planes and volumes but with no success.

Can anyone help me with this?

I’m also attaching a screen grab of the camera at its low position so you can visualize what I’m saying. At this vantage point, I would like to clip out the bottom chute.

Much appreciated! :slight_smile: link text

alt text

Ok. I got it resolved. I did finally find it here on the forums. I’m reposting my solution to this. (I’ll attach the FIXED unity project as well.)

I used a depth mask shader on my clipping plane.

Download the unity package here:

  1. I placed a material with the mask shader on my clipping plane. The clipping plane is an oversized mesh plane with a square cutout in the middle for the chute to go down into. The plane is also slightly below my Top Plane so the meshes don’t collide.

  2. Place the SetRenderQueue script on all objects to be hidden from view behind the clipping plane. (In my example, the chute and the elevator floor.)

  3. Hit Play :slight_smile:


Masking is the right way to go, but if you had problems I’ll recommend you to check the camera rotation/position frame by frame to active/deactive it based on that rotation/position. It’s not an elegant solution but should work.

Unity 3D Inverted Mask - YouTube this might help