What's the "cheapest" Glass Material?

What’s the “cheapest” Glass Material?

I am wondering what your experience is when creating shaders for Glass and using Forward Rendering.

Appreciate all your thoughts, hints, tips and ideas.

If you need to be able to see through it then unlit translucency.

thank you, so basically… those two components highlighted in the attached screenshot.

No, that’s one of the most expensive ways to make glass. The shading model should be set to UNLIT. Not Default Lit.

It will look bad, but I mean that’s kinda what you get when you want the “cheapest” glass material. If you want a better result my advice would be to use unlit translucency but sample a cubemap using the reflection vector and masking it with fresnel.

It will be unshadowed though which will make it look sort of ridiculous if you have a lot of lighting changes (blinking/moving lights) in the area

2 Likes


AFAIK it doesn’t get much cheaper than this. You can probably save a few instructions by doing a dot(CameraVector,PixelNormal) but whether or not it makes any actual performance difference? I have no idea.

7 Likes

Awesome, appreciate it.
I will give it a try. Thanks a lot!

If you don’t need actual transparency, another option is to fake the transparency by projecting the cubemap as an image refracted through the object, instead of reflecting it. This method is used by the fancy bottled liquid shader in Half-Life: Alyx, and has the advantage of being able to use the same shading model as regular opaque materials.

3 Likes

That’s a good idea too, it has the added benefit of being able to do cheap blurred glass by just increasing the mip of the cubemap. It works very well on complex shapes too because you dont have to worry about sorting.

As I recall though, in HL:A they repurposed their reflection captures in order to accomplish this which is why it worked so well for moveable objects. I wish we had access to the reflection captures from within the material editor :frowning:

3 Likes

Hello, I know this thread is almost a year old but I am currently working on a scene with alot of liquor bottles in it and I need to keep things efficient as it is in VR. This thread had some really good insight and I saw the comment about the Half Life shader using the cubemap with reflection. I am not a shader expert in any sense and I was wondering if more could be shared on how you would construct something like that. Thanks!

1 Like

Doing some searching and I am wondering if this link to a post may be what is being set up using an interior cubemap on a glass bottle shader as mentioned above. Maybe I am wrong though so please correct me with what what be a good approach.

Hi there,
Have you seen this video analyzing different translucency settings? It might help you. I planned to test it out in a few weeks.
How to make Glass / Transparent materials SUPER fast to render : UE4 - YouTube

1 Like

Any fake transparency shader will be limited to static cubemaps without modifying the engine to get access to the reflection probes, and they’re buried in there deep. I tried to find a way to dynamically write custom ones for a different purpose, but the system is so obscured that I couldn’t really follow it.

For a simple solid glass object sampling a static reflection map, something like this should work. The cubemap needs mips baked to be able to modify the blurriness.

3 Likes

Hello Rectus, I apologize for not responding to your reply earlier but I just saw this notification. Thank you for this and I am going to try it out.

Thank you L.F.A. I did see this video earlier and it was helpful on another project where I had a lot of glass windows in a building and the original shader was costing me to much…

1 Like