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

1 Like

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.


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.

1 Like

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:

1 Like