Hi Kent, I'm trying to make my own version of this shader, but I'm having trouble making it transparent.

posted to: Clip Art

Hi Kent, first of all, thanks so much for this series. This is my first time delving deep into materials and I genuinely feel that I'm starting to understand how blender materials work.


When I tried to make my own version of this shader, I ran into an issue. I was trying to mix the outline with a transparent BSDF, I found that I couldn't mask out the back faces from showing from the front. When I look at Suzanne from the back, as the pictures demonstrate, the front faces are still visible!

I've tried a Light Path node with Use Camera Ray, and I've tried dot-producting the Normal and Position vectors from the Geometry node, and using those as factors, but neither option seemed to change anything. I tried to use the Backfacing output, but that doesn't work for geometry that curves inwards.


How can I mask out only the faces that are behind others in relation to the camera, so I cant se the outline from things behind the camera? I have the file here: https://drive.google.com/open?id=1RzkupDSC3Zd7oUvyO_e3915qeOlRsNKb

Thanks in advance!

  • spikeyxxx replied

    Hi!

    Understandable 'mistake'. The problem is the monkey!

    What you call the front faces are actually back faces. Hard to verbalize what I mean so:

    You are not seeing the front of the monkey, but the 'back of the front. No Backface Culling will hide that. Hope that makes sense...

    What you want is for an object to be transparent, but not see what's behind it...

    I'm not saying that's impossible, but you should know what you are trying to achieve...


  • dmar1223 replied

    That makes a lot of sense, thank you! You're completely right, I'm trying to make a object be transparent but not see whats behind it. I can now see the paradox in that statement.

    I figured out that I was seeing the back of the front as you put it, but it didn't occur to me that Backface Culling or the Backfacing node wouldn't work there. I couldn't figure out how to mask those faces out. How can I do that?

  • spikeyxxx replied

    What I would do, is to swap out the Transparent Shader for a Holdout Shader. (you'll have to enable Film > Transparent for the Holdout to work!) like so

    Then make another render without Transparent Film and without the monkey and composite it using an Alpha Over Node:

  • dmar1223 replied

    Thanks again, the Holdout/Compositing  is working for the most part, but I can still see parts of the front of the monkey from the back.

  • spikeyxxx replied

    I honestly can't see what you could be doing wrong:

    Are your drivers up to date? (Mainly the graphics card.)

    Your Blender also looks a bit different from my 2.82.7, (I don't have those 3 'lines' below Options in the 3D Viewport, but I don't think that has anything to do with it.

    (I know the Screenshot is made in 2.90, but I also checked this in 2.82 to rule out some kind of bug)


  • dmar1223 replied

    I figured it out! Turns out I had the Blend mode and Shadow mode set to Alpha instead of Opaque! I tried that originally when using this to see if it'd help the transparent BSDF but it didn't occur to me to turn it off later!Those 3 dots by the way are just an addon.


    Thank you so much for giving up some of your time and helping me, I really appreciate it!

  • Kent Trammell replied

    spikeyxxx is a rockstar. Nice job doing your own version of this shader ddmar1223 !