godotengine / godot

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

GridMap tiles have white dots on them while the camera is not moving. #97462

Open stat-void opened 1 month ago

stat-void commented 1 month ago

Tested versions

System information

Godot v4.3.stable.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 (NVIDIA; 31.0.15.3598) - AMD Ryzen 9 5950X 16-Core Processor (32 Threads)

Issue description

(While I am primarily using a Windows machine, I have seen this happening on an OLED Steam Deck as well.)

I am using a GridMap in my game as a way to simplify level generation and have been doing a bit of stress testing in worst case conditions to see the performance of it, figure out how to approach it on optimization and whatnot. However, I've noticed from Godot 4.2 onwards is how something in my setup with the tiles is causing random white dot artifacts to appear on the tiles whenever I am not moving the camera around. I've tried to see if they might be present on other objects as well by adding them to the scene at random locations to look at, but the dots only seem to appear on the tiles themselves.

I've also tried creating a completely new project where I precreate a GridMap map with the same tiles that I've generated before, but haven't really noticed artifacts appearing in these situations, making it really difficult to understand what might be causing this.

One weird thing though is that when using regular sky lighting, these visual artifacts are still visible when ambient lighting is turned off for the tiles, meaning it's completely pitch black. Even weirder, while in sky lighting, turning on either fog setting in the world environment, even with 0 values and an invisible fog, makes these artifacts disappear completely, or at the very least making them really hard to notice. It's convenient for me since I wanted to use fog, but it shouldn't be something that's needed to avoid this kind of visual issue.

In the MRP project field, I've included a link that has 2 videos and a zip file of the project on this issue happening on my end.

Direct video links to Youtube:

Video 1 with the main game application

Video 2 with the MRP Project

Steps to reproduce

The project that I am developing is a C# project and it's a bit too time consuming to create a completely pure GDScript version for recreation, so the MRP project should be opened with the Mono version of Godot, and then C# Building needs to be enabled through Project -> Tools -> C# -> Create C# Solution.

Once that's done and the project is started, the mouse is used as a simple first person camera, Escape closes the game, and the 1 and 2 keys can be used to change mouse control, so that the editor can be used while the game is open.

The game will then automatically generate a 300x300 grid filled with tiles.

If everything goes as expected, then there should be white dots visible when the camera is not moving around. You can also use the WorldEnvironment field during runtime to see how the dots react to different settings, such as disabling the ambient light and still seeing dots, or enabling fog with a sky background to make the dots disappear.

Minimal reproduction project (MRP)

Link to files: https://drive.proton.me/urls/AV8N8QQ7YG#vD6phrEfIQBB

AThousandShips commented 1 month ago

Please add the videos to the issue report so it's easier to watch them

stat-void commented 1 month ago

Okay, uploaded the videos as unlisted directly on Youtube as well. It will take a little bit of time for it to process to HD, but otherwise is viewable.

Zireael07 commented 1 month ago

I think we had a couple of "fireflies"/"floating point errors" reported before, and usually on GridMeshes too

stat-void commented 1 month ago

A small update. I took a really close look at the white pixels when enabling and disabling the fog options, and found that the fog indeed does not cause the artifacts to disappear, they instead just became black dots that blend in far better.

Something about the fog settings does allow it to take control over the color of these dots, but with a proper regular bright fog, the artifacts would still be visible.