Shadow Catcher and Glass

Im trying to render a shelf on a wall with a glass on it. The wall has been set to be a shadow catcher, and the world background is transparent. The problem is that the shadow catcher is showing up in the reflection of the glass and i don’t want that at all.

I want to replace the background in graphics program so the glass needs to be transparent like the background is. How can i solve this?

I tried using the light path node on the wall on the is reflection ray which was plugged into a transparency node and mix shader with the walls Diffuse BSDF, but it did help.

Im also using an HDRI image for lighting. How can i solve this. Is there another way to solve it?

Shadow catcher material:

Defuse

Transparent

Light Paths

Transparent & Defuse into Mix node

Light Paths Is Camera Ray into Factor of Mix mode

Mix Node into Output.

This means the material will not cast shadows or appear in reflections and retractions, is only visible to the camera it’s self - and then it’s a shadow catcher.

You can vary this to have is cast shadows but not appear in reflections, etc.

Thanks for the tip… i probably should have should have said Im using 2.8. Will that still fly?

I Think so.

Hmm… cant seem to get it to work. I’m sure ive got the node up correct for that wall. Glass is still picking it up though. The green background was added in with Affinity Photo and should be seen through the glass, but theres no alpha on the glass at all as far as I can tell…

Nodes into mix node the wrong way round. At the moment, you are making it transparent for camera and principled for everything else.

It doesnt work which ever round i put them.

Under ray visibility, don’t you want to turn off everything except shadow?

No, thats turns it all off, even the shadows. Its not showing up in the glass reflections though, but the glass still isnt transparent in terms of alpha.

Could it be something to do with the glass material? Im using the glass from the Variety Node Pack.

Refractive glass does not take the alpha into account. If you want it to refract the background, your best bet is to make your shadow catcher into a diffuse textured with your background image - texture coordinates = window.

What do you mean by texture coodinates = window. Im kind of new to blender but not new to 3d. Really i just the want the ability to change the background without having to re-render it. I guess rendering to layers might do it, right?

I think that layers are your friend here, yes.

This is eevee based, but it will work in cycles as well.

It’s a method for getting glass with transparency and no reflection.

My next vid will cover glass with refraction, but (spoilers) the only way I can find to do it is basically setting up a Greenscreen in the 3D scene.

Thanks @yogyog but it wont fly in cycles. the Shader to RGB node is Eevee only.

Glass material: Fresnel mixing between transparent and gloss
Set material index to 1

In view layers activate material index

In comp nodes Set Alpha to Render Layer Alpha plus (material index multiplied by Render Layer :Image)

plus node should be clamped.

They added a new feature that lets you render transmissive materials as transparent when used with a transparent background:



shadow catcher.blend (719.1 KB)

Just adjust the roughness threshold to match the roughness of your glass object. You might need to render this in separate layers anyway because it seems to erase its own shadow when its casted behind the glass.

1 Like