How do I optimize my glass material?

So, I’ve got this museum level. LOTS of glass. Windows, display cases, fancy lighting fixtures, the works. And as you can imagine, that much transparency is going to kill my shader complexity. I understand having a little isn’t the end of the world, but I want to make sure I’m giving myself as much wiggle-room as possible before I start removing window panes and hoping people don’t notice.

What I’ve done so far.

1.) Swapped out materials for Instance materials, I’m assuming this helps but I am not entirely sure why.

2.) Glass becomes opaque at a distance. This doesn’t appear to affect shader complexity in the editor, so I’m just hoping it works. Bonus if this culls objects behind it (But I’m also not sure how to confirm that, for all I know this does nothing)

3.) Where applicable, used 1-sided materials instead of 2-sided.

I’m super down to hear if there’s a proper way to go about this, but I also want to know if there’s a way to perhaps tell UE5 not to render glass behind glass? Is that an option?

Update. Found out about Additive materials, this helps a lot! Only problems are that these don’t seem to want to go fully opaque, and the reflections can look a bit odd.

Is there a way I can just, not have reflections on these? I’ve followed this tutorial here: https://www.youtube.com/watch?v=g9npyBv6NII&ab_channel=Drawcall and I’m curious if I can’t get away with some sort of tint instead, but my attempts to remove the fake reflection causes the whole material to vanish. Probably asking for too much here.

So, how you want to handle glass in unreal really depends on your perf. budget and quality bar. There are very cheap ways of handling glass (as you are seeing), as well as very expensive ways of handling glass, but the big question is content. Is your museum defined by wide open lines of sight, or tight corridors? You can get away with a lot more complex glass if you keep your lines of sight and overdraw small.

There are and there aren’t ways of doing that. At the end of the day, that reflection is essentially all there is to that material, bc it’s sure not doing any lighting calculations. You could replace it with a simple vectorParam base color if you really wanted to cull it down, but without that HDRI it would have essentially nothing even making it appear physical.

If the glass becomes visually opaque but it’s doing so via a shader trick, it isn’t saving perf. bc the shader is still calculating it as translucent from a shading sense. You could have a LOD chain where the upper lods have an opaque texture though.

1 Like

If you don’t want to spend time optimizing then i would recommend these two glass material packs, both are free so you don’t need to worry about spending money and not liking the result.

Even if you want to learn then still i would recommend studying them, you can study how these materials were made.

1 Like

Ah, I was looking into the LOD option first, but I wasn’t able to get it working. I tried exporting my cubegrid mesh as an fbx and reimporting it as a LOD but that just resulted in the mesh vanishing.

Update: tried it again, and it worked this time, except the mesh comes back distorted

Here you can see the original mesh on the right, and the reimported one on the left.

I must have some weird setting active or something.

its a simple rectangular what more can you optimize it further maybe into a triangle when looking from further up the distance, also if you need to make like showcase glass or display cases why not use volumetric glass material with depth mask that way can also fake the lighting and depth and fog and what not with it.

For volumetric glass i would really recommend the volumetric glass material pack.

The optimization comes from replacing a transparent rectangle with this opaque rectangle at a distance. The volumetric glass looks nice, but I can’t really afford it at the listed price-point.

In that case you’ll have to make a blueprint for that glass mesh to switch material based on the distance of character or camera angle whichever you prefer based on your need.

Don’t switch lods if its giving you problems just switching to materials might help, make two copies of materials one with the closeup glass and another one with opaque one and switch between them.

You’ll probably find tutorials to switch materials based on distance or maybe some videos related to it.

Honestly, I would really recommend getting the volumetric glass plugin by the looks of it. Glass optimization is a huge pain and could easily become an enormous time sink for you. If you’re planning on releasing a shipping project, saving time with a ~$40 plugin could free up your time budget to build out the content that actually matters.

wait a minute i thought it is a free asset as i remember getting it for free but it’s been a while so i don’t if its free anymore, or maybe you’re just talking about some other volumetric glass plugin