2
$\begingroup$

This may be something very simple but I actually tried a bunch of things without any success.

I am looking or a setup that allows me to do this in 2.8+.

Let's say I have a cube sitting on a plane and I want to have two render passes the first one with the cube and the second one with the plane and the cube's shadow:

Scene

enter image description here

Pass 01, foreground

enter image description here

Pass 02, background + shadows

enter image description here

The setup was very simple in 2.7-, I just put the plane in the second layer and have 2 Render Layers foreground and background respectively. If I put the lamp on both layers, I get the result I want.

In 2.8+, however, we now have Collections and View Layers and I tried a lot of setups but none of them allowed me to have an equivalent of this. For instance, I tried puting the objects on two different View Layers but it doesn't allow the cube cast a shadow on the plane unless I use Holdout wich just leaves a big hole in the place of the cube on the background pass. I also tried using Indirect only but that renders the cube on the background pass.

Can anyone here suggest me a setup that can make this work?

Thanks in advance.

$\endgroup$

1 Answer 1

5
+100
$\begingroup$

This is simple... In Cycles.

Cycles

First, you need to have 2 view layers, so I guess You have no problems with it:

enter image description here

Next, enable Indirect only toggle:

enter image description here

Then, enable this for one collection with cube:

enter image description here Lamp in the wrong collection in my screenshot, sorry for that

In other view layer, disable second collection:

enter image description here

This is an analog of exclude in 2.7x, but you can also use Indirect only of course, to have reflections from plane:

enter image description here

So this is it, as you see it is just the same as in 2.7x, but the buttons in the different places.

But it works only in Cycles, EEVEE doesn't support Indirect only. For EEVEE I can suggest a workaround.

EEVEE

Duplicate collection with cube and make transparent material for the cube. Set alpha mode to Alpha Clip or Blend, but set shadows to Opaque:

enter image description here

Then disable collection with solid cube for layer one:

enter image description here

And enable original cube for layer 2:

enter image description here

This will work, but not expect screen space reflections to work (Cube will not reflect plane) But baked reflections and irradiance volume will work.

$\endgroup$
1
  • $\begingroup$ Thank you for the answer. I probably missed a step when I tried to use Indirect Only. $\endgroup$ Sep 2, 2022 at 12:22

You must log in to answer this question.

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