Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: cpvisual on 2024-06-25, 15:01:36

Title: Shadow Catcher
Post by: cpvisual on 2024-06-25, 15:01:36
We are trying to composite some 3D people on a scene we made and we are having issues with the shadows.

If we apply a shadow catcher material, to everything, but the 3D people, the geometry will not cast shadows, so the result is not realistic.

If we just add the shadow catcher material to the floor an render the 3D people and the floor, the shadows from the other geometry will be duplicated on the floor.

As an example, on the attached image, the floor is using a shadow catcher material. I need the shadows the pillars create on the teapot and the actual teapot shadow, I don´t want the pillars shadow on the floor, or this will be duplicated with the shadow from scene I´m compositing it with.
Title: Re: Shadow Catcher
Post by: maru on 2024-06-25, 17:43:31
Hi, sorry, but I do not fully understand what exactly you are working on.

1 - Do you have your scene rendered (i.e. a 2D image or a sequence) and you would like to composite people with their shadows on top of it? Or are you re-rendering a full 3D scene?

2 - Here you are saying that the geometry casting shadows is the desired behavior...
If we apply a shadow catcher material, to everything, but the 3D people, the geometry will not cast shadows, so the result is not realistic.

...but here you are saying that the shadows are unwanted...
Quote
If we just add the shadow catcher material to the floor an render the 3D people and the floor, the shadows from the other geometry will be duplicated on the floor.

...and here you are saying that you would like the shadows of the pillars to be visible on the teapot, but not on the shadowcatcher:
Quote
As an example, on the attached image, the floor is using a shadow catcher material. I need the shadows the pillars create on the teapot and the actual teapot shadow, I don´t want the pillars shadow on the floor, or this will be duplicated with the shadow from scene I´m compositing it with.

So please clarify what exact end result you are after. The shadowcatcher material is designed specifically to catch shadows, so if you do not want it to catch shadows, you should probably use another solution. To suggest some solutions, we first need to understand what exactly you are after.

Thanks in advance for clarifying!
Title: Re: Shadow Catcher
Post by: Frood on 2024-06-25, 17:53:30
It is about just another years old issue, see for example

https://forum.corona-renderer.com/index.php?topic=23822.msg144758#msg144758


Good Luck



Title: Re: Shadow Catcher
Post by: cpvisual on 2024-06-25, 20:19:40
Hi Marcin, thanks for your reply.

Let me clarify.

We rendered this scene for a video and rendered the people separately.

As you see on the composite, if I apply the shadow catcher to everything, the building doesn´t cast shadows, so the 3D people shadows is not realistic (you can see on the image there is shadows from the sun, even being blocked by the building)

If I leave the building without shadow catcher, it will apply the shadow on the ground, but it won´t differentiate from the 3D people shadow.

So in this case, the shadows from the building will be duplicated when compositing.
Title: Re: Shadow Catcher
Post by: TomG on 2024-06-26, 13:01:22
Wouldn't the second case work, so long as you merge the two shadow passes in post appropriately? Make sure they don't multiply each other (so building shadows get "counted twice") but something like Darker as a blend should mix the shadows together appropriately. Then you take this merged shadow layer and multiply it onto your renders.

(EDIT failing any blend mode working well, you could just use the building shadow pass as a mask in the people shadow pass, so that the people shadows disappear under the building shadows, I'd think).
Title: Re: Shadow Catcher
Post by: Tom on 2024-06-27, 02:57:21
(EDIT failing any blend mode working well, you could just use the building shadow pass as a mask in the people shadow pass, so that the people shadows disappear under the building shadows, I'd think).

Theoretically there's no reason why it shouldn't work but I would personally avoid doing this as you would inevitably have to work in high resolution and go through heavy mask refinement work in post production in order to have a nice, clean result.

I agree 100% with @Frood here when he says in this thread https://forum.corona-renderer.com/index.php?topic=23822.msg144758#msg144758 that "We need matte material or a tweaked shadow catcher urgently".
Title: Re: Shadow Catcher
Post by: maru on 2024-08-05, 17:30:32
I have a "proof of concept" version of this, but it seems that a proper solution is currently not possible with Corona, because the shadowcatcher does not correctly register environment lighting. We have this reported.
I was saving everything to 32-bit exr with alpha.
- Render the image as it should look like in the end - just for reference (the buildings, people, their shadows, etc - the beauty how it should look like in the end)
- Render the "buildings" without the "people" - this will be our backplate + the CShading_Shadows element for this
- Render the "buildings" with the "people" on top of a shadowcatcher. Make sure the "buildings" have Alpha set to "Always black" in their material properties (if it's a lot of materials, I guess a script could be used for this; or material override).
- In compositing app:
-- open the "buildings without the people" image, use it as the bottom layer
-- on top, add the CShading_Shadows image, set it to Add blending mode
-- lastly, on top, add the shadowcatcher image (transparent)

The attached image is showing the reference vs the composite.
Title: Re: Shadow Catcher
Post by: Aram Avetisyan on 2024-08-05, 18:27:06
Hi Marcin, thanks for your reply.

Let me clarify.

We rendered this scene for a video and rendered the people separately.

As you see on the composite, if I apply the shadow catcher to everything, the building doesn´t cast shadows, so the 3D people shadows is not realistic (you can see on the image there is shadows from the sun, even being blocked by the building)

If I leave the building without shadow catcher, it will apply the shadow on the ground, but it won´t differentiate from the 3D people shadow.

So in this case, the shadows from the building will be duplicated when compositing.

Hi,

Use RaySwitch material and plug the original building material (or even a simple opaque material) to GI slot (and to reflect/refract depending on the case), shadows should be fine.

Hope this helps.