godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.12k stars 20.2k forks source link

Lines appear black (Forward+) or not at all (Mobile) in `screen_texture` (such as BaseMaterial3D refraction) #86078

Open Calinou opened 9 months ago

Calinou commented 9 months ago

Tested versions

System information

Godot v4.2.stable - Fedora Linux 39 (KDE Plasma) - X11 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 4090 (nvidia; 545.29.06) - 13th Gen Intel(R) Core(TM) i9-13900K (32 Threads)

Issue description

Lines normally Lines behind refractive material
Screenshot_20231211_231955 Screenshot_20231211_232000

This mainly affects the editor as lines seen through a refractive material will appear black. It can also affect projects that use line drawing (e.g. when using Visible Collision Shapes or Visible Navigation).

A more minimal example where the issue may be more obvious:

image

The refractive material is the box in the middle.

In 3.x, lines don't appear at all behind refractive materials, regardless of whether GLES3 or GLES2 is used.

This appears to be related to the depth prepass: disabling it in the Project Settings while using Forward+ hides the black lines behind refractive materials.

Steps to reproduce

Minimal reproduction project (MRP)

test_refraction.zip

clayjohn commented 9 months ago

This is caused by the lines using depth_draw_alpha_prepass. I'm not sure why they do though. At any rate, this will be fixed by https://github.com/godotengine/godot/pull/83895