Here is what i want to do: enter image description here

I want the penrose triangle behind the flask. The triangle is partially in front, but i want part of it to render behind the flask. However the flask is glass, so the triangle needs to also be visible behind the flask.

The only I can think of is to break the triangle into multiple objects and join them in the compositor. Any better suggestions?


I have a somewhat imperfect solution for you, but I think you could work it up into a perfect one.

enter image description here That's a very raw render from the technique I'm suggesting.

enter image description here And here's the compositor node tree.

I've used two render layers, one for the flask and another for the triangle. I've also given both objects Object IDs and the layers Object ID passes. Rendering uses the Transparent setting in the Film section.

Take the Object ID masks from the two layers/objects, and use the Math converter "Minimum" to create a binary mask of their overlapping areas.

Feed that into an Alpha Over node that takes as its input two versions of the flask layer, one opaque and the other translucent.

Then some more jiggery pokery to make sure that the transparency of the background is preserved, because otherwise it would obscure the triangle. That takes the Minimum of the Alpha values from the previous Alpha Over node and the original Layer.

Then another Alpha Over with the mixed-alpha flask as the second input. It shows the flask in front with the triangle visible through a translucent section.

Unfortunately there is no refraction, as there would be with rays cast through glass. You might be able to achieve it with a more complex set up, if you want to. But as it is, the flask is always in front but with the triangle visible.

Please forgive the crudeness of the models and render.

Edit: Slightly better example: enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.