Mirza Beig offered some shader magic tips.
Last year, we featured a beautiful glass shader by Mirza Beig, which included chromatic dispersion, distortion, refraction, blur, and fresnel effects, making it a nice solution for simulating a wide range of transparent materials. Recently, Mirza shared more insights into his approach in response to a Unity artist seeking to recreate this project.
The goal is to simulate glass-like distortion by sampling the _CameraOpaqueTexture, which shows the scene without transparent objects. By offsetting screen-space UVs using surface normals, view direction, and optional normal maps, you can create the illusion of refraction.
The core technique uses the HLSL refract function with a reversed view direction and surface normal, adjusted by IOR. The resulting direction is transformed to view space and used to distort the screen UVs when sampling the texture. Simpler hacks like grayscale normals or fresnel effects can also be used as alternatives.
See the original post for details and get Mirza's customizable, shader-based shield with fully interactive touch, hit, and impact responses:
Follow Mirza Beig on X/Twitter and join our 80 Level Talent platform and our new Discord server, follow us on Instagram, Twitter, LinkedIn, Telegram, TikTok, and Threads, where we share breakdowns, the latest news, awesome artworks, and more.