4
$\begingroup$

I created hologram shader and using it for the human head model. But the model has eye sockets and mouth bag, which is why I would like to use backface culling to hide them. Found some tutorials which guide to use nodes: geometry>backface> transparent mix shader But as can be seen in my shader nodes, the fac is already used for the effect. Any workaround?

enter image description here

$\endgroup$

2 Answers 2

6
$\begingroup$

Hulifer's answer is correct about the Fac problem. But backface culling as suggested in the question doesn't solve the mouth bag, tongue, teeth, eyes sockets, eyeballs, "X-ray" problem. Except you want to have a creepy "X-ray" look for the hologram, of course.

backface culling hologram

When you have an object inside of another object (e.g. mouth bag inside the head) then you have four layers that the ray penetrates:

  • head (front) → mouth bag (backface) → mouth bag (front) → head (backface)

(The teeth and tongue are ignored for the sake of simplicity.)

The hologram shader shown here makes the backfaces fully transparent and invisible. But the overlaying front faces are semi-transparent and both are visible which results in the X-ray look:

  • head (semi-trans.) → mouth bag (fully trans.) → mouth bag (semi-trans.) → head (fully trans.)

A better result is achieved when only the very first surface is visible and all other surfaces behind it are fully transparent (=invisible):

  • head (front, hologram) → mouth bag (fully trans.) → mouth bag (fully trans.) → head (backface, fully trans.)

magic box hologram

Long story short, I would use a Magic Box shader for Cycles that uses the Light Ray > Transparent Depth input instead of Geometry > Backfacing to hide all overlapping surfaces behind the first one. With the Light Path > Is Shadow Ray input you also can get rid of the hologram's shadow.

Important: Because there is much overlapping transparency you need to increase the Cycles > Light Paths > Max Bounces > Transparent (e.g. 16). Otherwise, you can get black shadows.

$\endgroup$
2
  • $\begingroup$ Hi, this is an awesome answer and effect. Is there a way to limit the hiding to work per object only? For example, if I had a separate object with the mesh of a brain inside the head with the same material as the head, I would want each object to be visible and each object to hide the overlapping parts of its own mesh. I can think of doing it with separate render layers, but I was wondering if there was a way to solve this in the material itself. Here's an example I made with a sphere and an oval: imgur.com/a/to6flM9 And the material: imgur.com/a/adx71ad $\endgroup$
    – aspirino67
    May 3, 2023 at 21:05
  • 1
    $\begingroup$ Hi. I don't think you can get this desired effect with a shader only because it doesn't know from which object the transparency ray should be blocked and it blocks all inner objects as you see in your screenshot. On the other hand, the outer sphere/head is just a transparent object with no backfaces showing = a transparent overlay. In this case, you can render the outer sphere on a separate layer with transparent background (I think you need a new scene) & use the Compositor to create the final image combing the 2 rendered images with an Alpha Overlay node. $\endgroup$
    – Blunder
    May 15, 2023 at 8:42
4
$\begingroup$

You can multiply the fac with the backfacing boolean.

  • If Backfacing is false (0), you want to leave the fac unaltered (multiply by 1).
  • If Backfacing is true (1), you want the fac to be 0 (multiply by 0).

So we just invert the boolean and multiply with the fac.

Material Nodes

Before:

render no back cull

After:

render with back cull

$\endgroup$

You must log in to answer this question.

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