You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To sum it up, the background shader gets rendered on top of a cube object as you can see in this image, notice the little white spots on top of the cube:
The solution is to change the way the background shader handles depth.
For me, this solution works for Compatibility renderer:
POSITION.z = -1.0 * projected.w;
Godot v4.3.stable - Windows 10.0.19045 - GLES3 (Compatibility) - Radeon RX 580 Series (Advanced Micro Devices, Inc.; 31.0.21912.14)
But Forward+/Mobile, I need to do that instead:
POSITION.z = 1.0 / projected.w;
Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated Radeon RX 580 Series (Advanced Micro Devices, Inc.; 31.0.21912.14)
Steps to reproduce
Open https://github.com/tiffany352/godot-starlight in Godot 4.3 and move the 3d viewport camera in front of the cube object in the scene, and observe how the background renders on the cube. Switch renderer between Forward+/Mobile and Compatibility.
I believe this is a documentation issue. I don't quite understand all the details well enough to fully explain them, but there are differences in the internal coordinate spaces of the Compatibility and the Forward+/Mobile renderers that won't be changed for compatibility reasons. One of those differences is the z value of the far clip plane. godotengine/godot-proposals#10273 gets into it a little.
In 4.4 we now have access to CLIP_SPACE_FAR (#95057) and preprocessor defines (#98549), so you now have the tools to write shaders that will work in all renderers.
In this case, if the comment is accurate and the goal is to always render at the far clip plane, you might be able to use: POSITION.z = CLIP_SPACE_FAR;
I think that the existing docs issue godotengine/godot-docs#10204 in theory covers this case. But we should probably leave this issue open, to track specifically documenting the far clip z value.
Tested versions
Tested and reproducible in Godot 4.3 stable and Godot 4.4 dev6.
System information
Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated Radeon RX 580 Series (Advanced Micro Devices, Inc.; 31.0.21912.14)
Issue description
This issue explains the problem tiffany352/godot-starlight#2
To sum it up, the background shader gets rendered on top of a cube object as you can see in this image, notice the little white spots on top of the cube:
The problem has been identified with this line:
https://github.com/tiffany352/godot-starlight/blob/bc7a4cc22b53fc42986a6c9c0fe369f86b8f3a9d/addons/starlight/Star.gdshader#L65
The solution is to change the way the background shader handles depth.
For me, this solution works for Compatibility renderer:
Godot v4.3.stable - Windows 10.0.19045 - GLES3 (Compatibility) - Radeon RX 580 Series (Advanced Micro Devices, Inc.; 31.0.21912.14)
But Forward+/Mobile, I need to do that instead:
Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated Radeon RX 580 Series (Advanced Micro Devices, Inc.; 31.0.21912.14)
Steps to reproduce
Open https://github.com/tiffany352/godot-starlight in Godot 4.3 and move the 3d viewport camera in front of the cube object in the scene, and observe how the background renders on the cube. Switch renderer between Forward+/Mobile and Compatibility.
Minimal reproduction project (MRP)
https://github.com/tiffany352/godot-starlight
The text was updated successfully, but these errors were encountered: