2
$\begingroup$

I'm trying to make a group of foreground objects transparent as a single entity, where they occlude each other like solid objects and then have transparency applied after, instead of each individual one having its own transparency.

There is an option in the material settings called Show Backface, but that only works for single objects. Is there a way to apply this effect for a group of objects? Merging shouldn't be an option as the foreground may also contain rigged characters and such. The objects in the screenshots below are only to demonstrate what I mean.

I also thought about compositing the foreground and background together as separate layers, but then I run into a problem of the background not containing shadows of the foreground (and vice versa), or if I render foreground + background as one layer and only background as second layer, then the shadows occluded by the foreground will start fading out too. Another thing I thought about was duplicating the whole foreground and giving everything a fully transparent material to render the background with shadows, but I'd rather avoid duplicating anything.

Is something like this possible? Compositor solutions are also welcome.

Transparency of each individual objects, not what I want. Transparency of each individual objects, not what I want.

Transparency of a group as a whole, I want this. Transparency of a group as a whole, I want this.

$\endgroup$
3
  • $\begingroup$ I'm afraid it does come down to duplicating your objects, because you need one set of them being transparent and casting shadows, and another set to actually render. Been trying some setups, and that's the best I could do, too. Also, just curios why the top result is undesired? It looks more realistic to be honest. $\endgroup$
    – Geri
    Oct 2, 2021 at 18:17
  • $\begingroup$ It's for a scene where a character is very close to a camera and you still need to see what's behind him. The problem is, my characters are modular, being composed of various parts like body, face, hair, clothing and accessories, like in a game with deep character customization, and it just looks wrong seeing every object being transparent individually. $\endgroup$
    – Jack
    Oct 3, 2021 at 10:34
  • $\begingroup$ I see. I think the best you can do with eevee is after you deem your scene ready for rendering, duplicate your character's objects, and have one view layer where they're invisible to the camera so they're still casting shadows, and another layer where the background is disabled and your character is opaque, and comp them together. $\endgroup$
    – Geri
    Oct 3, 2021 at 11:16

3 Answers 3

6
$\begingroup$

Compositing Eevee

  • enable Shadow pass
  • change Cubes material setup of Alpha mode to Blend.
  • create View Layer for
    • Foreground objects
    • Background object
    • and one for all objects to composit Shadow pass

enter image description here

The trick here is Alpha Blend mode in material. Objects with Alpha Blend are not visible for Shadow pass ... technically Im not advanced in this area to explane WHY ... I dont even know if it is bug, missing feature or intended ... it just works like that. So if someone has an explanation for it - please dont hasitate to edit my answer (or create a new one).

enter image description here

It is still a mistery how this result can be helpful, but I guess that is what you asked for :)


Compositing Cycles

Under Outliner > Filter enable Holdout and Indirect Only
and use them in a way as shown on screenshots for each View Layer ...

enter image description here

enter image description here

$\endgroup$
4
  • $\begingroup$ Does this work with eevee though? I tried it and the Indirect Only features seems to not work with it. OP tagged eevee that's why I'm asking. $\endgroup$
    – Geri
    Oct 3, 2021 at 8:51
  • $\begingroup$ Yep, I thought about this, but sadly it doesn't work in Eeevee. Hopefully they'll make it work at least for shadows one day, like they did with holdout. $\endgroup$
    – Jack
    Oct 3, 2021 at 10:23
  • $\begingroup$ @Jack check the edit ... it should cover your Q now. $\endgroup$
    – vklidu
    Oct 3, 2021 at 13:12
  • 1
    $\begingroup$ Wow, that's a very nice trick. Thanks! Anyway, you can read what it's intended for in a comment to the OP. $\endgroup$
    – Jack
    Oct 3, 2021 at 19:52
2
$\begingroup$

Found another solution by random using geometry nodes, which doesn't require setting up any extra view layers or doing anything in the compositor.

Individual Object Method

  • Add geometry nodes to one of the objects (or you can create a new empty one just for this purpose)
  • Link in all other objects using Object Info node (also switch to Relative so they keep their position)
  • Merge them together using the Join Geometry node
  • Hide the actual objects, that you merged, from the scene
  • Don't forget to turn off Show Backface in material settings for your materials

Individual Object Method

Outliner

Collection Method

  • Put all of your objects into a collection
  • Create a new object outside the collection with geometry nodes
  • Link the collection objects using Collection Info node
  • Run it through Realize Instances node
  • Disable the collection from view layer
  • Don't forget to turn off Show Backface in material settings for your materials

Collection Method

Outliner

Result

Result

$\endgroup$
2
$\begingroup$

Material-only Eevee solution:

enter image description here

Only a single layer of refracting ojects will be rendered by Eevee, so use refraction (1.0 IOR, 0.0 roughness) instead of transparency and enable screen space refraction. Full shadows, single layer transparency without compositing or geo nodes.

$\endgroup$
3
  • $\begingroup$ Very nice and simple solution! Though that also means I need to enable screen space reflections right? I'm doing NPR and I use glossy shaders to create speculars from lamps and I'd rather avoid other objects reflecting on those. $\endgroup$
    – Jack
    Jan 11, 2022 at 19:04
  • $\begingroup$ Yeah, I guess you'd need that-- but if you don't want to use it for anything else, you might be able to get away with reducing the max roughness on the screen space reflections. $\endgroup$
    – Nathan
    Jan 11, 2022 at 19:43
  • $\begingroup$ That's a good tip, I usually use something higher than 0 and then sharpen it with ramps. Thanks. $\endgroup$
    – Jack
    Jan 11, 2022 at 20:13

You must log in to answer this question.

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