[URP] Fix Glass Material Transparency and Refraction
Solution
Unity 2021.3.x - Unity 6.3.x
Published 20 days ago
When attempting to render glass with transparency in Unity's Universal Render Pipeline, the desired visual effect, particularly when using a transparent base color texture alongside metallic and roughness maps, may not be achieved. This often results in glass appearing as a flat semi-transparent gray or failing to distort the background correctly compared to high-fidelity rendering environments.
To properly render transparent glass within the Universal Render Pipeline, it is essential to isolate your glass material from other materials applied to your model. This ensures that transparency and Refraction properties can be managed distinctly.
- In the
Projectwindow, locate and select the activeURP Asset(found in theGraphicssettings). - Under the General tab, ensure the
Opaque Textureoption is checked. This allows your glass material to sample the scene color for Refraction. - Open the
Materialinspector for your glass. Set theSurface Typeto Transparent and theBlending Modeto Alpha. - Scroll down to the Surface Inputs and ensure Refraction is enabled. Adjust the
DistortionandIndex of Refractionvalues to achieve the desired physical accuracy. - If using
Shader Graph, ensure theScreen Space Refractionnode is utilized to sample theScene Colorproperly.
Additional Tips:
- Use a
Smoothnessvalue close to 1.0 to ensure the Refraction isn’t blurred by micro-surface detail. - For high-performance mobile projects, consider using a simple
Alpha Blendwithout Refraction if theOpaque Texturepass is too costly. - Ensure your model’s mesh has properly calculated normals; inverted normals will cause the Refraction to distort inward rather than outward.
TL;DR
To achieve proper glass transparency within Universal Render Pipeline, the glass material must be separated from other materials, and Refraction must be enabled within the URP Asset settings to leverage the Opaque Texture for realistic distortion.
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.