0
$\begingroup$

I've tried out backface culling on a concave shape, and since some faces are not backfacing all the time, they show through the model:

enter image description here

Here's a 180 degree view:

enter image description here

(For the confused: this is a cube with one of it's corners cut out, not a slab in the corner of a room.)

Would a node setup that would hide these faces (the ones showing through the model) be possible?

Some constraints:

The model has a single cycles shader, using the color and alpha channel of an image texture. Backface culling is enabled.

I don't want to use a holdout in the place of the transparent part of the shader, since I intend to have more geometry behind this model, and a holdout would exclude that geometry aswell.

$\endgroup$
3

1 Answer 1

2
$\begingroup$

The face in question is occluded, but it is not backfacing. A few changes so I didn't have to download textures:

enter image description here

The face you're seeing is blue with normals overlay, indicating it is front facing: its normals point in the opposite direction of the view vector, plus or minus 90 degrees. It is not being culled by backface culling because it is not backfacing. It is occluded instead.

You've indicated this is for Cycles. But backface culling in the material settings (notice: "viewport display" subsection) does not function with Cycles anyways. These are settings for Eevee, which is used for the material preview. So it doesn't matter that backface culling doesn't do what you want, because in Cycles, it doesn't do anything. (You can set up backface culling for a Cycles material in its nodes, but since that doesn't do what you want anyways....)

To set up a material that doesn't show occluded faces in Cycles, you can use a slightly different material. I guess I'll just go ahead and download those textures...

enter image description here

Rather than using transparency, I'm using a 1.0 IOR refraction BSDF, which changes the ray type from camera to transmission. After that, I can mix into transparency if it is not a camera ray.

Note that this is going to impact other things than just the camera for bounces; what you want may vary and depends on what else you want to do with your scene. (As shown, this won't show up in mirrors; it won't show up through glass.) It also doesn't work with render/film/transparent settings (it will show the world in the refraction surface rather than alpha if there's nothing behind it)-- if you want that, you want to mix with holdout instead of mixing into either refraction or transparency.

An alternative way to handle this is to render a solid cube, the alpha output of that solid cube as emission, and the background, and then composite between them, but as this involves multiple renders, I would personally rather make it work in the shader nodes.

$\endgroup$
1
  • $\begingroup$ Thank you so much for the speedy reply! This is a great solution to my problem, and I don't mind the limitations, it'll be interesting to work around. $\endgroup$ Commented Jan 9 at 7:39

You must log in to answer this question.

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