Better Glass

This thread is my jam! And by jam, I mean a huge bugbear I’ve wanted to improve forever. And I’ve just gotten back from a wonderfully relaxing Christmas holiday at my parents house so I’m going to chat a bit. I’m not actually back in the office til next week though.

This was my ideal design for the glass block! Like you, I’m not super happy with the aesthetic of the current glass block, but it looks the way it does for some pretty important tech reasons.

The biggest and baddest reason of them all is that we simply do not support semi-transparent block textures. I asked about this back when I was making the glass block and the thing is, semi-transparency is crazy expensive, rendering-wise. I’m not a graphics programmer so I can’t talk in detail about why that is, but basically it adds a whole nother level of calculations required to every single block, because if just one blocktype is to be semi-transparent, all other blocks are affected by that. Anything that adds to the expense of rendering one block even a little bit becomes a BIG HUGE EXPENSE when you’re rendering a world made of thousands and millions of blocks.

I yelled and screamed about it(well, okay, I pouted a bit) but 1-bit alpha is all I get, so basically a pixel is either completely transparent or completely opaque. No in-betweens! This directly affects specularity and normal maps too, so I can’t have a ‘completely transparent’ block that’s still shiny like glass.

I tried a bunch of different ways to work around this including some old-school dithering effects, but nothing looked right - fine dithering looked too solid, larger patterns looked artificial and weird, ‘what if the glass is just opaque’ missed the point of glass blocks entirely, et cetera. I couldn’t find a good compromise! I’m still open to rethinking the frame design, but without the frame to tell you something is there, the glass block would just be completely invisible. And the frame needs to be relatively hefty so it doesn’t just get mipmapped out of existence at a distance.

FWIW, we do support semi-transparent materials on items, creatures and player characters. The glue, blood and healing items that we recently added to the game are in translucent glass bottles, although I need to spend some time working on that as it runs into some 3D sorting issues ingame. They currently don’t look much like they do in Maya, which is definitely a big issue for me. Let me assure you that I am very dedicated to getting the best-looking glass I can achieve with the tech I have :stuck_out_tongue:

19 Likes