Hide Part of 2D Sprite

I am struggling to figure out how to dynamically hide portions of a sprite. In my scene, when objects cross in front of a ‘mirror’, an identical sprite is created so that it looks like the object is in front of a mirror. However, I am struggling to figure out how to only display the part of the sprite that is in front of the mirror. For example, when the object is only halfway into the mirror, only half of the sprite should be rendered. I have tried working with the DepthMask shader, but I am cannot get it to work. I am not exactly sure what I am supposed to do with the SetRenderQueue.cs file, I tried attaching it to the masking objects (as suggested here in the alternative uses), but it doesn’t seem to mask any of my sprites.

I have also tried using the sorting layers to hide the sprites. With sorted layers, the sprites are hidden only if I display the masking objects in the camera’s culling mask, but I don’t really want to be stuck with visible objects surrounding the mirror.

Any help would be appreciated.

This is in Unity Free btw, so RenderToTexture is out.

Some images would be helpful.
Does your your players back face the cam, etc?

I would think. Tho, that using a camera, dedicated to the mirror would be helpful.

Yeah, I initially tried using a mirror cam, but I was unable to figure out how to capture the mirror-camera with my player’s vision cam. Attached is an image explaining the idea I am looking for.1722590--108667--m.png

I know you can define a cameras area in space. For instance you can define two cameras to show split screen. So, you can also define a camera to define a rectangular mirror.

Sorry, i didn’t explain myself very well. I had a mirror cam working in that captured what was in front of the mirror and displayed it on the screen; however, the mirrored image was displayed OVER the object, which is incorrect. If there is a way to layer the viewport behind GameObjects, then that would probably work.

You can layer which camera goes on top of which.

I think you can solve your problem only with the SortOrder Option of the Sprite and using a transparency sprite to emulate a mirror. Using just one camera. I make a draw to ilustrate the idea.

1722898--108686--mirror.jpg

http://wiki.unity3d.com/index.php/MirrorReflection

watapax, ill take a look.
renman, that requires pro-but exactly what i wish i could use

That doesn’t work Watapax.