Sandbox Logo

Glass Shader

The new shader by default allows you to set the index of refraction, this combines nicely with roughness at very low rendering budget cost.
Since the Glass shader is available on the base addon, it can be used as a template to make your own glass effects.

We have a sights shader with thin film diffraction that we will use in our weapons that derives from the shader.
Real glass absorbs through some of the light and casts a shadow, usually games don't simulate that phenomenon but that's silly.

We approximate diffraction with the BRDF, refraction index and other material properties of the glass, giving it a pretty convincing effect.

In real life, the more rough a glass surface is, the harder it gets to see what's behind it, photons scatter through all sorts of directions making what's refracted seem blurry.

We try to approximate similar to how it'd be in real life, grazing angles would have higher index of incidence of the scattered ray, the effect is very cheap regardless of the blur level you have.
When we started authoring shaders we were experimenting until we found best practices that work for everyone, we have a good framework for that now that we can work towards the aim of the game's release.

We're aiming to rework all our built-in shaders to have a more unified pipeline, starting with the new glass shader, rewritten from scratch.
Glass is much simpler to use and looks a ton better, taking proper physically based energy conservation into account, and you can layer other materials on top of it.

Comments