4
$\begingroup$

Image oneIs there a way to have an object (for example a small ring behind this cube) that is appears to be in-front without cube being transparent? I want the ring to still be green and I don't want to see the background or the cone bleed through the cube. Is it possible to move one object 'in-front' of another while it is actually behind? Hope this makes sense. Thank you

Image two

$\endgroup$
1
  • $\begingroup$ Somewhat related: blender.stackexchange.com/q/62237/5705. This isn't exactly what you are looking for, but it's kind of similar. (My solution there could be modified to work in your case if the back object was perfectly circular.) $\endgroup$
    – PGmath
    Commented Aug 27, 2017 at 17:48

1 Answer 1

5
$\begingroup$

I don't believe this is possible within Cycles alone but can be easily achieved via the compositor by using different render layers and the Z Combine node.

First, set up the Render Layers - go to the Render Layer properties and create a new layer (by clicking the '+'). I named my layer 'No Cube'. In the 3d window, select all (A) and then press M to move them to other layers. On the layer popup, hold Shift and click the second layer box - you should now have both highlighted indicating that the objects (all of them) are now in both layers. Highlight those objects (ie, the cube) that you want to be transparent, press M again and just click the first layer box (this time without holding Shift) - this will place those objects just in the first layer. You should now have two layers - one with everything except the objects you want to be transparent and the other with everything (including those to be transparent).

Now switch to the Compositor and create the following nodes :

compositor nodes

Press F12 to render the layers.

The two Render Layer nodes provide the results of the render. The Z Combine node combines them based on the distance from the camera. The Maths Subtract node adjusts the Z depth of the second image so that anything less than the distance specified in the Subtract node is classed as closer than the cube and so will show through it. Anything obscured by the cube that is further than the distance specified in the Subtract node will be still obscured by the cube.

Reducing the value of the Subtract node will change the difference in distance before the obscured objects will show through. For example, setting it to a value that corresponds to only part way through the cube can produce the illusion that one object is actually intersecting with the other (whereas it's actually behind it).

intersecting

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .