logo80lv
Articlesclick_arrow
Research
Talentsclick_arrow
Events
Workshops
Aboutclick_arrow
profile_loginLogIn

Making Stunning Glass Refraction Effects In Unity

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 InstagramTwitterLinkedInTelegramTikTok, and Threads, where we share breakdowns, the latest news, awesome artworks, and more.

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more