0
$\begingroup$

I would like to create a shader/material based mask that is 1.0 for anything that is seen in the camera view and 0 for anything that isn't. I'd like to use this to have the semi transparent hands of my character not show fingers behind those that are infront. The way it is right now shows overlap on the fingers themselves aswell as where they start.

enter image description here

Kind of lost on this one, would appreciate any help!

$\endgroup$
3
  • 1
    $\begingroup$ Take a look at "Light Path" node, especially "Is camera path". You can use this value to mix between two shaders for example. $\endgroup$
    – Lutzi
    Mar 1 at 15:05
  • $\begingroup$ @Lutzi I've tried this. But Anything that is visible is considered a camera ray. If I use transparency then the things that overlap are also a camera ray. But thank you for the input, I appreciate it $\endgroup$
    – Poppi
    Mar 1 at 15:54
  • 1
    $\begingroup$ What about Material tab -> Settings -> Show Backface OFF ? $\endgroup$
    – Lutzi
    Mar 1 at 15:57

2 Answers 2

1
$\begingroup$

Eevee gives you a Show Backface option that does what you are looking for :

enter image description here

And the result when disabling it :

enter image description here

As I understand it :

  • ON : Display all faces
  • OFF : Only display faces that are both viewed from the front and not view through other faces
$\endgroup$
1
  • $\begingroup$ Oh man.. I was so confused as to why this didn't work when I first tried it, that it made me go down this whole "camera facing mask" rabbit hole. It's the blend mode. I didn't know backface culling doesn't work with the alpha hashed blend mode. I'm also using cryptomattes which, to my knowledge, have a problem with alpha blend. Hence why I didn't even try it. That said, thanks. I'll see if I can get my compositing setup to work with alpha blend. $\endgroup$
    – Poppi
    Mar 1 at 17:35
1
$\begingroup$

Mixing a Transparent BSDF and a plain white RGB node (This can be any other node as well. I went with it as it probably is the way most people will use it), and then mixing this again with a Transparent BSDF, with the factor as the Transparent Depth output from the Light Path node will give you that 2D like effect.

enter image description here

Before:

enter image description here

After:

enter image description here

NOTE: This is possible in the Cycles Render Engine only

$\endgroup$
3
  • $\begingroup$ Transparent Depth is listed as Cycles Only in Blender documentation. Is your test Eevee or Cycles ? $\endgroup$
    – Lutzi
    Mar 1 at 16:40
  • 1
    $\begingroup$ @Lutzi This was done in cycles. The OP did not mention the use of any specific engine in the question(Although, I jst saw that he has put a eevee-render-engine tag). Also, this does give the effect the OP requires(Atleast in cycles). So I am keeping this answer. I will edit and add that this can be done only in Cycles. $\endgroup$ Mar 1 at 17:01
  • $\begingroup$ Yes, I did come across this before, but as you corrected, it's sadly cycles only. Still a valid solution though. $\endgroup$
    – Poppi
    Mar 1 at 17:37

You must log in to answer this question.

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