From 6a3bdf6d9fc8993c6f3cc520db233b305f33c19c Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 8 May 2023 17:44:06 +0200 Subject: [PATCH] Document SpatialMaterial refraction limitations --- about/list_of_features.rst | 2 +- tutorials/3d/spatial_material.rst | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/about/list_of_features.rst b/about/list_of_features.rst index 9394b5bf5..5f62d3704 100644 --- a/about/list_of_features.rst +++ b/about/list_of_features.rst @@ -181,7 +181,7 @@ Editor - Dithering can be determined on a per-pixel or per-object basis. - *GLES3:* Parallax/relief mapping with automatic level of detail based on distance. - *GLES3:* Sub-surface scattering and transmittance. -- *GLES3:* Refraction with support for material roughness (resulting in blurry refraction). +- *GLES3:* Screen-space refraction with support for material roughness (resulting in blurry refraction). On GLES2, refraction is still functional but lacks support for material roughness. - *GLES3:* Proximity fade (soft particles). diff --git a/tutorials/3d/spatial_material.rst b/tutorials/3d/spatial_material.rst index d2366a79f..e91773d21 100644 --- a/tutorials/3d/spatial_material.rst +++ b/tutorials/3d/spatial_material.rst @@ -484,8 +484,31 @@ When refraction is enabled, it supersedes alpha blending, and Godot attempts to fetch information from behind the object being rendered instead. This allows distorting the transparency in a way similar to refraction in real life. +Remember to use a transparent albedo texture (or reduce the albedo color's alpha +channel) to make refraction visible, as refraction relies on transparency to +have a visible effect. + +A normal map can optionally be specified in the **Refraction Texture** property +to allow distorting the refraction's direction on a per-pixel basis. + .. image:: img/spatial_material23.png +.. note:: + + Refraction is implemented as a screen-space effect and forces the material + to be transparent. This makes the effect relatively fast, but this results + in some limitations: + + - :ref:`Transparency sorting ` + issues may occur. + - The refractive material cannot refract onto itself, or onto other + transparent materials. A refractive material behind another transparent + material will be invisible. + - Off-screen objects cannot appear in the refraction. This is most + noticeable with high refraction strength values. + - Opaque materials in front of the refractive material will appear to have + "refracted" edges, even though they shouldn't. + Detail ~~~~~~