# Which glass shader is physically correct?

Maybe I should of titled this, "which way is MORE physically correct". I understand adding the light path node breaks the physically correct part.

I am messing around with glass shaders and have come across THIS post and a couple other ones on YouTube. I am looking for the most physically accurate shader but am looking to to optimize it the best I can for rendering times and fireflies.

What is the difference between these two shader setups?

I dont see a difference in render, but I see a big difference in refraction. So which is the correct set up with the correct refraction?

Notice the IOR is the same on each node.

If you take a look out of the window you can clearly see that it is refracting different. Nothing was changed but the node set up. Even the reflections look the exact same.

• I am thinking the transparency's falloff is different with the math nodes, so thats why I am getting different refraction!?!? But what are the math nodes doing and which way is better and why? both had same render times also. – icYou520 Apr 23 '18 at 22:56
• – user1853 Apr 24 '18 at 1:10

Technically, using Maximum is better than using Add - since with Maximum the result will be in the correct range of 0.0 to 1.0 for the Factor input of the Mix node. With Add you end up in the range 0.0 to 3.0 since you’re adding three 0.0 to 1.0 values together. While this won’t in itself cause a problem (since Factor of the Mix will auto clip to 0.0 to 1.0) it could cause a problem or unexpected results if you later use the same value for other uses, not realising it’s outside range.

Without knowing what’s outside the window it’s difficult to tell which is ‘right’ - try rendering without the glass (either hide the window pane mesh or set to 100% transparent) - the thin sheet of glass should cause hardly any displacement (since it’s two parallel surfaces) - whichever more closely matches the view without the glass is by far the most accurate..

After setting up a test, the second example is by far more realistic for the refraction :

Good refraction :

This can be made even more apparent by simply rotating the glass along the Z axis.

Your 'Add' nodes, between them, although they can add up to more than 1, are tantamount to a logical OR of the summands.

Your first node tree says:

If the incoming ray is (a Shadow ray OR a Diffuse ray OR a Glossy ray): evaluate the surface as Transparent (i.e. having no effect on anything seen through it).

Otherwise: evaluate the surface as the Principled BSDF,( including an IOR of 1.45)

Your second node tree says:

If the incoming ray is (a Shadow ray OR a Reflection ray): evaluate the surface as Transparent.

Otherwise: evaluate the surface as the Principled BSDF.

Let's follow a ray from the camera through a pixel on the screen to the window (a). It strikes the window's front surface. This is a Camera ray, so the that point is evaluated as the BSDF.

Because the BSDF has a specular strength, but no roughness, it spawns a glossy reflection ray, (not shown) which finds the objects in the room, and contributes to the color of the point on the front surface of the window. so far, no difference between your trees: both of them show reflections.

(Note that the 'Reflection ray' condition you have in the second tree will affect how other objects see the window when they reflect it, not how the window sees other objects.)

The BSDF also spawns a transmission ray, (b), which is bent, because the BSDF has an IOR of 1.45. So far, there is no difference between the trees. But now, the ray hits the back face of the window.

(b) is Glossy. So in your first tree the backface of the window is evaluated as transparent, and the ray which will bring back a sample of the background shoots off in a straight line (c'). But in your second tree, the surface will evaluate as a backfacing BSDF, with an IOR of 1.45, so the outgoing transmission ray will bend back to its original direction (c).

That's why the window transmits such radically different views of your backgound. The second tree behaves more like real refraction. As far as I can see, the 'Glossy' condition is the only one making a significant difference to the appearance of the window.