2
$\begingroup$

I'm trying to make these glass planes on the ceiling but something weird is going on with the glass shader. I tried couple of different ones but nothing seems to do the job. I'm talking about shadows that these glass planes are casting, especially the dark areas on the walls, I think this is not how it would look like in real world and these shadows are way to dark.

result

node set ups i tried: node 1

node 2

I also tried just glass shader or principled BSDF shader but with IQR set to non 1 value the glass looks wrong so I mixed it with glossy shader. With these shaders by themselves the problem also occurred.

$\endgroup$
6
  • 2
    $\begingroup$ Hello :). Rest assured, Glass BSDF with IOR=1,450 is a physically correct glass. It may not fit your expectations, but it's 100% realistic. $\endgroup$ Commented Apr 12, 2021 at 14:55
  • $\begingroup$ Well, how it can be realistic when it distorts everything behind a glass plane with that IOR? When you look through a window you don't see such a distortion $\endgroup$
    – Bartek
    Commented Apr 12, 2021 at 15:16
  • $\begingroup$ Well, perhaps there are other aspects of your scene, that make the glass pane look wrong :). But the Glass BSDF shader is a physically correct representation of glass. $\endgroup$ Commented Apr 12, 2021 at 15:29
  • $\begingroup$ How thick are the panes? $\endgroup$
    – PGmath
    Commented Apr 12, 2021 at 18:05
  • 1
    $\begingroup$ @JachymMichal You are correct, but without infinite time to let cycles resolve caustics we need a workaround. I am trying to think up a canonical answer to the glass problem in cycles. $\endgroup$ Commented Apr 14, 2021 at 14:38

1 Answer 1

12
$\begingroup$

If you look at reference photos online, it does appear that glass casts a shadow of sorts. What happens is that some areas are darker and some are lighter due to refraction and reflection.

some of these images, I'm sure, are also renders

In blender, it looks like the default settings don't allow the full amount of light through, so I ran a series of tests. The scene is a simple drinking glass and a small area light.

enter image description here

I've raised Glossy and Transmission bounces to avoid any issues with total internal reflection a la this talk, but otherwise the first image is with the default settings. You can see the shadow is very dark. Unclamping Indirect Light and unchecking Filter Glossy both gave interesting results. Doing both at the same time, however, seemed to be on the right track.

Here's a render at 100,000 samples.

enter image description here

And this, to me, does appear physically correct. The downside is that it takes a lot of samples for cycles to fill in an area with light. Denoising works to cut down the samples required, but it still helps to run a higher number of samples to get clearer refraction effects.

I pulled the light in to get some more dramatic effects. Here's a glass Suzanne at 1000 samples denoised.

enter image description here

And here's the same Suzanne along with some other examples at 5000 samples denoised. If you were wondering if the Glass BSDF and Principled BSDF gave different results, they don't appear to.

enter image description here

That and the next hexagonal prism are examples of how adaptive sampling can work against you. Here are a few renders at 100,000 samples denoised.

enter image description here

Modern hardware (RTX3070) and the speed improvements in Blender 3.0 made it reasonable to produce this image at 1,000,000 samples, with denoising.

enter image description here

I'm legitimately impressed at Cycles' results here, it's actually quite nice if you're willing to give it the time. If you're unable to do that, you need to fake it.

You've tried one of the popular workarounds which is a Transparent BSDF on Shadow Ray. I applied it to the glass panes in this test scene just for fun, but when I did I ran into a problem that you might be running into.

enter image description here

As you can see the shadow on the final pane is much darker. Since we introduced transparency, we must raise the number of transparency bounces a bit. I have 5 planes here, so 10 was enough for me.

enter image description here

When you use this shader to approximate glass, you can control how much shadow displays by changing the Value of the Transparent BSDF's Color. I found that a value of .9 to .95 is pretty close.

enter image description here

Just to wrap up, I should explain why the default settings are the way they are. Prior to all these settings, a really common complaint was that any glass added a lot of noise to the scene. These would eventually resolve into those light rays, but at the cost of a massive amount of render time. The fix at the time was just to disable caustics.

The Blender developers added these settings to clamp the light added to the scene, but unfortunately this has caused an issue for your use.

$\endgroup$
2
  • 1
    $\begingroup$ Oh my god, did you just convince Cycles to calculate refractive caustics?! That Suzanne result is unreal! $\endgroup$ Commented Apr 20, 2021 at 10:02
  • $\begingroup$ Hi. By "1000 samples denoised", do you mean: You use 1000 samples for render + Enabled Denoise? $\endgroup$
    – Vikas
    Commented Oct 27 at 4:52

You must log in to answer this question.

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