Glass surfaces are treated as opaque by shadow rays

There is no caustics involved. Transparency shader don’t need caustics enabled to transport light. I’m only reducing how much light passes based on the angle; once through the mixing with glossy, then a second time by controlling its color (to kind of compensate for some total internal reflection energy loss). Frankly, this is probably not even needed for anyone - it’s just my OCD kicking in.

I’m only talking about simple single sided one pane flat “glass” windows. The approach can not be used on solid and curved meshes - it just won’t look good. This is a hack for architectural style glass windows only - since windows are flat you don’t really need refraction (ignoring refraction roughness for now).

Sorry, I see better now. Yeah a hack is still needed to get realistic results. That’s what I’m hoping can be resolved at some point: Cycles is meant to provide realistic lighting OOTB, and this is a very obvious hole in its realism at the moment.

It does. And you can render out a 3 piece glass windows using glass shader if you want. You just need to rely on caustics light transports and a ton of time to pass enough samples through it, as the current path tracing implementation have limits (but offers other possibilities). I need my renders immediately, so I sacrifice some accuracy.

There are hacks available for regular glass too, that both improves shadow handling and some light amplification to fake caustics. But currently it can’t compete with real caustics. See top of thread for some of these hacks. Other render engines can also handle caustics better than current Cycles, might give those a try.

I never encountered this issue until recently as I needed to essentially simulate the effect of light through windows more or less realistically. The “Is shadow ray” trick sort of works for completely transparent windows, but what about frosted windows?

I have a scene with a window with an external grate similar to this real-life photo: https://i.imgur.com/kjOORzp.png

The shadow and the grate from the inside would be expected to be blurred if shadows were realistically projected through the frosted glass, but with “Is shadow ray” they are both fully sharp. How to solve this?

You need to fake it. The only way to actually “bend” rays through a medium is to rely on refraction caustics.

  • Refraction provides control over ray spread through roughness and normals - I guess, never tried.
  • Translucency you get a full even (Gaussian, I guess) distribution, without refraction caustics.
  • Transparency will get you sharp shadows as if sharp refraction, but without relying on refraction caustics.
    I never tried, but I assume getting anything sharp from refraction caustics, both shadows and highlights, require an insane amount of samples. I would just fake it by making the light source bigger and ignore falloff not being accurate.

For frosted glass, I mix diffuse with translucency. Then mixed with refraction. Then using fresnel (or usually layer weight pow 5 add 0.05 as I mostly use glass panes without thickness) to mix in glossy at the end. Refraction is hooked up to a geometry/incoming node so I can get frosted look (refractive highlights from a point source) using its roughness controls. I have not been successful in modifying this normal with bump maps and such, it just goes crazy :stuck_out_tongue: Something is happening, but not the normals I’d expect.

For (sharp) shadows, I mix in a fresnel (or layer mix as above) Transparency shader with Refraction.

1 Like

I would need to fake the (blurred) shadows and I don’t understand how this could be done with the suggestions above.

Doing another little comparison at this point in time. The situation appears to be about the same, albeit possibly a bit misunderstood: With caustics enabled, you do indeed get some correction for the way glass is supposed to influence shadows… it’s just that this effect doesn’t appear to be accurate and strong enough.

For a thick complex glass item it is pretty accurate: That looks about how you’d expect a glass statue to bend light. No light dispersion yet unfortunately, but if you need that you can simulate it via a shader at the moment. The bigger issue is with thin glass panels for windows.

With a simple 6-face window (cubic / rectangular shape) you get quite a bit of darkness around the edges but not the center. Interestingly this issue improves if you add a bevel modifier to put more vertices around the edges… even then however the sides remain pretty shadowy.

The light you do get seems to persist even when the panel is angled in relation to the light, so that’s a bit of good news. In this case too however, I think we can agree a glass panel of this shape ends up casting an unrealistic amount of shadows.

One more thing I should specify: The amount of samples you use doesn’t seem to make that big of a difference in the light that gets through, it only affects the general noise level as expected. Did a comparison with OpenImageDenoise since without denoising you generally can’t tell anything from all the grainy dots. As can be seen the exact same amount of light goes through in every circumstance… unless something were to magically happen at one billion samples or such which I doubt, the trend seems to be about the same in the end.

10 samples:

100 samples:

1000 samples:

I’d use sharp shadows from Transparency shader, which is then blurred out by making the sun disk much bigger. If for some reason you need a regular .5 degree sun for reflections on objects, you could bake out the big suns result on the room. This is outside of what I normally face and probably involve render passes, so I’m not sure how I’d approach it.