Working on our FPS project - Triptych - and a marketplace kit of glassware - I met a pretty unpleasant problem. That is, glass material didn’t work as expected. Especially the specularity on translucent materials. Here I’ll post my progress on finding a workaround.
First, let’s understand how glass material works in real life. Being an almost completely transparent material, it’s not opacity that makes it seen. Here’s a reference image to figure it out:
Seeing how the translucent blend mode didn’t handle the results I needed, I tried the masked blend mode and fed a fresnel into the input. Here’s how that turned out:
(fyi, the Fresnel phenomenon is that non-metallic surfaces turn into a perfect mirror when viewed from an angle close to 180 degrees). So basically this is a step in the right direction though causes specularity to affect the shadows. And the material still lacks “substance”, and the masked blend mode doesn’t support refraction.
So I decided to combine both approaches - use two instances of the same mesh with different materials - one to handle the specularity, one - the refraction and opacity. Doesn’t look much, but definitely better:
I’ll keep you updated on my progress, and whether I find a better approach than placing two instances of the same mesh at the same location - which is a bit “dirty”, if you ask me.
Both meshes side by side, to compare: the fresnel reflections are handled by the one on the left, and the standard glass material handling the refraction is on the right.
The combined approach yields better results; but still far from perfection I’m afraid.
Remember to set the Fresnel mesh not to cast shadows; or else reflective parts will affect dynamic shadows, which isn’t exactly how you’d expect your material to work. Self-shadowing only is another possible choice.
After some fine-tuning, here’s what my materials started to look like - a lot more acceptable and more surface, though now it has a bit of “milkiness” when exposed to light directly.
Try using the Advanced Lighting Map from the starter content, glass relies on reflections and transparency to look good, and this starter map is a bit too bare.
Before rolling in the next version, here’s a bit of advice - DO NOT BAKE AO MAPS. Generate them from the normal map. Because the inside of the model is going to look awful. Also, a curvature map would be fun to play with, to map the reflections.