Cycles - Glass shows shadow


#1

As shown in the screenshot. All 3 glass are same shader but while window is able to pass the light through it, table glass are showing solid shadow at bottom.

Shader is created by mixing Glass BSDF and Transparent BSDF node.


(txusmiCG) #2

Hi

More information about shader (fac mix for example) and render settings would be useful to be precise but…

blindly the problem could be in Bounces configuration for Transparency and/or Transmission in Render Settings (Light Paths)


(burnin) #3

Different angle - different shadow intensity. It’s fresnel!

With it, the quantity of light passing through transparent objects depends on how those are positioned against the light source. From almost no shadow, while surface is perpendicular to light source (90°), to full shadow while it’s in parallel (0°).

Huge difference might also occur, if there’s not enough bounces set.


(SterlingRoth) #4

I’m gonna echo bounces depth. Set diffuse and glossy bounces to at least 6.

Also, buckle up for noise, that much real glass is gonna have consequences.


(Pixelfox) #5

Is the window perhaps a single polygon, where the table glass has actual volume?


#6

Thank you guys for the quick response. This forum is awesome.
Increasing number of transparent bounces fixed it.

@SterlingRoth What do you mean by “real glass”. Is there anyway to reduce noise? Some way to fake glass?

Will using just Principled BSDF be better choice?


(SterlingRoth) #7

I’m just gonna raise the flag for @CarlG - He knows fake glass better than most people on this forum

in short, you want simple fake glass to override the shadow rays and just assume the glass is transparent:


#8

@SterlingRoth Thanks. What if I want glass to have just a little opacity and not make it fully transparent.


#9

@SterlingRoth with this node setup, I am getting mirror like effect. It doesn’t look transparent and shows mirror reflection but at the same time it also doesn’t have solid shadow, which is glass-like property.


(CarlG) #10

Well, I don’t know about that, but… :smiley:

Glass shader consists of refraction and glossy mixed with fresnel. Refraction is not “transparent”, it needs refractive caustics enabled for light rays to go through. So the common trick is to use a Transparent shader for shadow rays.

But light penetrate the same way you can see through it (if you need to go this route, usually you don’t) - at glancing angles you can hardly see through anything, it will be fully reflective. Similarly, you should use 1-fresnel (I tend to exaggerate it further) to drive the color of the transparency shader. Making light at shallow angles causing a deeper shadow than light right in front of it. Example where this is easy to see.

For glass in windows and doors without thickness/volume, I would use the SterlingRoths trick, simply ignoring fresnel wrt shadows. But I would setup a custom glass; fresnel to mix transparency and glossy with a transparency shader for shadows. However, preview the fresnel effect and flip normals accordingly. If you want the material to work from both sides, you need to do a 1/IOR for the backfacing faces which is then fed into fresnel node. The same applies to a normal glass shader, or from the outside you will appear to be looking from “under water” (snell’s window) and have total internal reflections. That trick makes the material “double sided”. If you want to use refraction shader instead of transparency shader (for roughness control), use Geometry/Incoming as the normal input (critical for thin surfaces).

For the glass tables, I’d use glass shader with transparent shadows, but definitely add a green volume absorption node with high enough light paths set in the render settings. You want that green rim unless you want some specialty glass. Total internal reflections going on in the inside of the glass makes the light path much longer, and thus a lot more light gets absorbed/tinted. To can to some extent fake this too, but why bother? Example glass table with “greener rim”.

I can’t do much more to help, as my files are on a busted computer, and even my crappy laptop sounds like it’s about to throw in the towel :stuck_out_tongue:

Edit: corrected and added some links.


#11

@CarlG Super thanks for such an elaborate answer. But I don’t have the expertise to fully understand it.

We probably don’t need glass shadow to be responsive to the angle of light. Also, we don’t need volume absorption and green tint on the sides.

Basically, we can compensate for hyper realism for saving on render times (and noise/sample).
But with @SterlingRoth 's node setup I am getting the mirror-like effect. I understand that at lower angles, there will be more reflection than viewing glass from direct front. But it wouldn’t be fully reflective like it appears now too I guess. How do I reduce the effect of reflection in the above node setup?


(SterlingRoth) #12

Check the normals on your table, I bet they are inverted. The node setup should work fine, but if the normals are inverted, you’ll run into issues.


(CarlG) #13

Agree on the shadow, more so on the windows and door. But green tint on the table sides is automatic if you do a simple greenish volume absorption node - looking “through” the glass the effect will be a lot less visible than when looking “into” the glass from the sides. It will look more like proper glass should react, and the cost isn’t terrible. It’s not a source for noise, generally.

But yeah, it looks like the normals are flipped. You’re looking from inside the glass into a table of air, causing snells window as mentioned earlier. I typically (unless specific reason for a particular project require it) don’t include the reflection ray when doing similar to his setup, only the shadow ray.

It’s always best to share the minimum of the project that will still be problematic. Can’t help myself though atm, but I’m sure others will.


#14

@CarlG @SterlingRoth
I used layer_weight instead of Lightpath and it worked. It’s not accurate but for my use case, it is sufficient.


(CarlG) #15

Layer weight instead of lightpath? Sounds weird. Here is example of what I wrote about, although crappy due rendered on a crappy laptop.
glass

Packed blend (if it works):
Glass002.blend (123.3 KB)


#16

@CarlG Yes. I saw it here https://www.youtube.com/watch?v=rOss2OqDiIE


(CarlG) #17

Ok, so layer weight (not light path) makes sense. If you add a little constant, you get kind of what actual fresnel does. The difference is really not important enough to worry about. using layer weight, you don’t have to worry about the backfacing faces. But both of them will kinda fail if used on actual thick objects.

Also note that volume absorption will have an effect on shadow computations.

For me, fake or real, is situational. I like to make my assets “real” (except I don’t like to rely on refraction caustics) but knowing how to fake it even more if real takes too much time. I’ve had “double shadow fake glass shadows” stuff in real projects, and nobody except myself was aware of the issue/noticed it, so I let it pass.


#18

Ok. So I guess. I will keep using node setup with LayerWeight. I have adjusted Fac for my need. I will and probably add Volume Absorption node too.