A physically-based glass shader designed for the Unity Built-in Render Pipeline (BRP) and VRChat environments.
This shader applies the Beer-Lambert Law to simulate physical light absorption based on the thickness of the glass. This achieves a realistic glass material where thin areas appear transparent, while thicker areas appear denser and darker.
The shader has been verified to work in Unity 2022.3.22f1, 2022.3.22f2, 2022.3.6f1 and VRChat.
- Instead of simple texture compositing, it calculates the distance (thickness) light travels through the glass to reproduce exponential color absorption based on depth.
- It calculates the refractive index differences based on light wavelength to express prism-like edge details (Chromatic Aberration).
This shader has been tested and verified in the following environments:
-
Unity Version:
- 2022.3.22f1 (Verified)
- 2022.3.22f2 (Verified)
- 2022.3.6f1 (Verified)
-
Platform:
- VRChat
