Cycles masking object (blocking partial rendering of object) I am slowly starting to get to grips with Blender basics, but i am currently stuck.

I made a very basic scene using a hdri backround. I would like to create a plane that would "block" the rendering of an object so that it will look like the object is moving around the corner of the building.

The image shows the effect I am trying to create. The sphere on the right needs to be partially hidden by a plane and the background rendered as if there was nothing in front of it.



I looked at this example :
Create invisibility cloak (alpha mask material)
When I enable the Film->Transparent option the plain in front of the sphere does partially block the rendering of the sphere, but then I have no background.

hdri background :
Your link is broken so I can't see the method you're using.

You can continue like you are and render two images: one of the spheres with transparency on, one of just the background, and then composite them with the Compositor.  I don't believe you can use Render Layers here because the Tranparent option is not render-layer specific.

Or you can do what I did and use a cube to act as the building corner with the Boolean Modifier enabled:





Just make the corner cube invisible and set the following options: