I would like to switch the material of one object (A - blue square) to transparent if this objects is between another object (B - gray sphere) and the camera. (It's a complex object so switching by "facing normals" are not working).

There are examples with the Texture Coordinate node but these examples are only show the relation of two objects.

I have two objects but the material must be also dependent on the camera view direction. How can I achieve this?

Also, what is the meaning of the Camera option in the Texture Coordinate node? The documentation states: "Position coordinate in camera space."

I thought it means, the position of the object the Texture Coordinate node refers to in camera space. This would be great, because I could compare them directly (A closer to the camera than B or the other way round, depending from which side I look) but I'm not able to get it to work. enter image description here

  • $\begingroup$ I think, I completely misunderstood the camera option. As it's a camera projection, the select object field is not applied even if there is still a name in it. So texture coordinates will not help to solve this. Is there any other way of achieving this? Maybe with geometry nodes combined with material nodes? If comparing to another object is not possible, how about comparing to global 0 coordinate position? Any idea? $\endgroup$
    – Steve
    Jan 17, 2023 at 18:12

1 Answer 1


Finally I was able to find a solution. It is based on an example and a fantastic explanation of how Vector Transform works from Rich Sedman from this post: How is the vector transform node used

Thank you Rich for your help!

I added conversions from Object to World space at the beginning which is essentially an apply transform within the material node. This way if the objects are moving, the effect moves with them. I also added a check if the obscuring object is in front of the target or behind. This is needed as otherwise the effect would be also visible from the the other side. (Where the obscuring object is actually behind the target.)

Seems to work but maybe there is possibility for optimization.

Here is the node setup: Node Setup


You must log in to answer this question.

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