Fixing refraction #9580
Replies: 3 comments 3 replies
-
These artifacts are inherent to the use of screen-space refraction. To my knowledge, there isn't really any alternative that's usable in real-time rendering performance-wise. You can make certain objects not show up in the refraction by setting their depth draw mode to Never, but this can introduce other rendering issues. Do you use a normal map for the refraction? What is your refraction strength value set to? For a convincing glass effect, I generally suggest using a normal map but keeping refraction strength close to 0.
It might be possible to exclude certain pixels from the refraction based on the depth buffer (similar to what screen-space reflections do), but this sounds nontrivial and it'd have an added performance cost. |
Beta Was this translation helpful? Give feedback.
-
Hello Calinou, thanks for your answer. I'm using the minimum (positive) value of 0.01 for Refraction scale. I understand your point; I know that with screen space it's only tricks what can be done... |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
At the moment Godot 4 offers an in-built refraction in the materials that has a few issues:
As shown in the picture, refraction exposes a problem when used together with alpha, where objects in front of the material in question are mirrored. Another issue is the very high level of distortion directly proportional to the camera distance (if you move the camera back a few meters, the reflection goes bananas).
These issues (mainly the mirror effect) render reflection unusable (as it needs to be used together with alpha, and it's supposed to be an effect that increases realism).
Some "dither transparency" shaders can be found online (to workaround the usage of alpha) but they no longer work on Godot 4 (as far as it was tested).
What do you guys think?
Beta Was this translation helpful? Give feedback.
All reactions