Glass shader keeps reflection of environment map even though it is set to Transparent


(abedd) #1

For testing purposes I created a cube and applied a Glass material to a quad face of it as illustrated in the image below (principled shader mixed with transparent shader controlled by a maximum math of Shadow ray and reflection ray) and the reason why I gave it such combination is to allow a sun light ray to enter through the glass, and it worked. But now the glass won’t render with complete transparency, even though the “Transparent” option in the Render tab is ticked. If I zoom out, I see no Environment texture (HDRI) in the 3d view, but if I zoom into the cube, I see the reflection on the window glass.

What’s the solution if I want to have both, the glass material (with its reflectivity, refraction and everything) and the HDRI light effect on the room but without the image information? I want it transparent cause I need to do a whole separate set of post processing in the compositor.


(zanzio) #2

I’ve heard the explanation for this before. I can’t remember exactly what it was, but it was something to do with how cycles handles refraction. You can’t stop the material from reflecting (not refracting) the environment, but with the current stable you can use fake glass that doesn’t have refraction for the window (you can have the glossy materials reflect another environment though).

What you want is basically a new feature that was added to the master build, so you might want to use that version for your project if you don’t want to use fake glass:
Screenshot%20from%202018-09-14%2009-59-16


(CarlG) #3

Search. Myself and others have explained many ways of handling glass. Thin transparency based with attention to normals would be sufficient in this case. I don’t get why people want “refraction” in flat glass panes.


(cdog) #4

This is exactly why thin glass node setup should be bundled with blender. I posted the setup here - it omits refraction as @CarlG mentioned and even fixes fresnel on backfaces.


(Justin Goran) #5

oh my god, I’ve been trying to solve that back face IOR bug for ages and ended up giving up as it only seems to come from the Fresnel node and the PBR node doesn’t have this problem. I tried reversing the normals on the back side but never thought to reverse the IOR, that makes far more sense


(CarlG) #6

Unfortunately there isn’t one thin glass node setup, but a whole heap of them depending on the complexity you need. My own library has four; simple sheet, advanced sheet, simple solid, and advanced solid - all transparency based meant for glass panels, all with their own strengths and weaknesses. I’m sure many will provide glass setups when call for material content starts.

Although I support included glass materials for easy reference, a better option would be to expand the glass shader itself with builtin fakes - first step would be separate controls (color, roughness, normals) as you get from a manual real glass shader (fresnel, refraction, glossy).


(CarlG) #7

Without a button to control it, this is a two edged sword; you either can’t have double sided fresnel for semitransparent surfaces (like i.e. leaves are too costly to have thickness on) and other double sided materials, or you can’t have proper solid glass where IOR is inverted (1/IOR) for the backface which is absolutely must have.

I don’t know how Renderman Disney shader behaves in this respect, but I think they used to have separate shader for glass/transparent materials with their own setting. That’s a while back though.


(zanzio) #8

The folks who aren’t as technically adept just expect anything you can see through to work the same as transparency. This causes confusion when they enable an option that makes the background transparent, but doesn’t affect refractive materials.

For the record, I wasn’t saying either method was better, I’m well aware of the fact that you won’t notice missing refraction on thin glass. I was just mentioning why it didn’t work with the default glass shader, and telling him about the different things he could do to resolve the issue.


(abedd) #9

Thank you all. That was super informative! now I have a couple of options to deal with this case.