-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3D Meshes disappearing (glitching?) in worlds with lots of objects. #73166
Comments
Looks like an already reported issue but I can't find the number. Try disabling auto LOD on your meshes |
Please upload a minimal reproduction project to make this easier to troubleshoot. Can you reproduce this after increasing |
@Zireael07 I tried setting generating LOD OFF and re-imported everything. Still happens like here: @Calinou As you can see it does happen with objects which are nearby, well I think it happens to far away ones too from the video but that's hard to tell if it's a different issue or the same thing. If there's already a bug report and actually with a minimal repro project do you still want me to make one or not? |
The closed issue I linked was actually fixed, so this is a different issue.
MRPs that only use GDScript code are preferable because they're easier to run (and rule out C# being the issue), but C# is acceptable. |
@Calinou @Zireael07 If you can't reproduce it, it might be because your HW can handle this better but I can't do anything with that so sorry you'll have to up the size and find best spots for yourselves to reproduce (shortcut to print the player and camera_pivot transform is ctrl + Q, change the transform then in the Player script so you can later return to that spot with CTRL + E). I'll add a video to show that it does happen there, if you need to modify the size check the repro steps in my original post too I've added instructions. Here're at least two screenshots: From the monitors you can see the number of objects is about 400k so be aware of it when playing the project. Also, I mentioned this in the repro instructions but when I play the project it sometimes just freezes and I have to press stop and then play again and then it starts in just couple seconds, this happens regularly when I make changes or so I'm not sure but could this also be a (different) bug when adding a lot of objects or is it just my computer acting up? I think this is all I can do here, unless you need something else from me? EDIT: I've added a video with the repro project in the repro section. |
Curious, i tried with 50k cubes with shadows,with multi mesh , and didn’t see that issue, although the camera was far away and was just a perfomance test on my igpu. Hope i helped a bit. |
I tried with an iGPU and Nvidia laptop GPU on PopOS 22.04 and an RX 6900 XT on Windows 10 and could not reproduce. For those that can reproduce, can you run the engine from the command line and post what is printed to the console, including what is printed upon closing the project. I am looking for a message along the lines of |
@clayjohn Click meTextServer: Added interface "Dummy" TextServer: Added interface "ICU / HarfBuzz / Graphite (Built-in)" Text-to-Speech: SAPI initialized. WinTab context creation failed. Using "wintab" pen tablet driver... OpenGL API 3.3.0 NVIDIA 528.24 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce GTX 1660 Ti WASAPI: Activated output_device using IAudioClient3 interface WASAPI: wFormatTag = 65534 WASAPI: nChannels = 2 WASAPI: nSamplesPerSec = 48000 WASAPI: nAvgBytesPerSec = 384000 WASAPI: nBlockAlign = 8 WASAPI: wBitsPerSample = 32 WASAPI: cbSize = 22 WASAPI: mix_rate = 48000 WASAPI: fundamental_period_frames = 480 WASAPI: min_period_frames = 480 WASAPI: max_period_frames = 480 WASAPI: selected a period frame size of 480 WASAPI: detected 2 channels WASAPI: audio buffer frames: 480 calculated latency: 10msTextServer: Primary interface set to: "ICU / HarfBuzz / Graphite (Built-in)".
Using present mode: VK_PRESENT_MODE_FIFO_KHR
TextServer: Primary interface set to: "ICU / HarfBuzz / Graphite (Built-in)". |
I can't reproduce this on 4.0.rc b7723a0 (Linux, GeForce RTX 4090 with NVIDIA 525.85.01). I've tried starting the project several times, pressing Ctrl + E before moving the mouse, resizing the window, etc. Verbose output
|
Nothing is coming up in the console. So it is most likely not the same issue as #70406 (surfaces getting freed and not reallocated when using threaded rendering) |
For me it's as I mentioned also locked to some positions and angles but it doesn't seem to be locked to axis as for @bithunter32 I've tried the project in Compatibility mode and then Mobile mode instead of Forward+ and had the same issue. Not sure if it's a helpful info or not. If I change camera Far to anything below 182 then the issue disappears and here's a screen when it's 182 when it's the last value for me when it still happens, the screen looks different a bit I assume that's the the camera cut off (left side). I also tried changing about everything in the Limits in Rendering in Project Settings but nothing made any difference. |
It was only locked in the default example but it doesn't seem to matter. When i change the scene other positions and angles trigger it. No output out of the ordinary when it happens Log
Update I tried the same on Ubuntu 20.04 and get the exact same result. Same positions and angles. |
That's interesting, combined with the fact that your monitor shows number of drawn objects falling it seems to suggest stuff is improperly culled? |
Since it is always reproducable for the same frustum settings it seems to be a culling problem. Its also stable.. means when the camera isn't moving nothing jitters - the objects are just not drawn. |
@Zireael07 Actually I double checked and it does happen even with Far set to lower values it just happens at a different angle, if anything in my example for me when I lower the Far to 181 it happens even more frequently than with far at 4000, the angle is just different, it's about 30° to the left and the same angle to the right from my demo for me. Again I have no idea why this is happening. I can only test this on my side and report what I see when someone asks me too ;-). |
@Zireael07 I tested this on the current master. So if i can help with debugging somehow I will gladly do so. Though i have no idea where to look or how to proceed right now, since i don't know much about godots code base :o) |
The culprit appears to be --- a.cpp 2023-02-16 00:19:33.255925572 -0500
+++ b.cpp 2023-02-16 00:19:51.606337018 -0500
@@ -3086,35 +3086,35 @@
//#define DEBUG_CULL_TIME
#ifdef DEBUG_CULL_TIME
uint64_t time_from = OS::get_singleton()->get_ticks_usec();
#endif
- if (cull_to > thread_cull_threshold) {
+ if (false) {
//multiple threads
for (InstanceCullResult &thread : scene_cull_result_threads) {
thread.clear();
}
WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &RendererSceneCull::_scene_cull_threaded, &cull_data, scene_cull_result_threads.size(), -1, true, SNAME("RenderCullInstances"));
WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);
for (InstanceCullResult &thread : scene_cull_result_threads) {
scene_cull_result.append_from(thread);
}
} else {
//single threaded
_scene_cull(cull_data, scene_cull_result, cull_from, cull_to);
} Context: godot/servers/rendering/renderer_scene_cull.cpp Lines 3100 to 3119 in aa6ec76
Edit:
@clayjohn This issue only pops up with |
Can confirm this. Forcing only single threaded there fixes the issue. |
At least it does not appear anymore in the example but there seems to be a problem with _scene_cull in general. if (false) {//if (cull_to > thread_cull_threshold) {
//multiple threads
for (InstanceCullResult &thread : scene_cull_result_threads) {
thread.clear();
}
WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &RendererSceneCull::_scene_cull_threaded, &cull_data, scene_cull_result_threads.size(), -1, true, SNAME("RenderCullInstances"));
WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);
for (InstanceCullResult &thread : scene_cull_result_threads) {
scene_cull_result.append_from(thread);
}
} else {
uint32_t cull_total = cull_data.scenario->instance_data.size();
uint32_t total_threads = WorkerThreadPool::get_singleton()->get_thread_count();
for (uint32_t p_thread = 0; p_thread < total_threads; ++p_thread) { // total_threads == 8
cull_from = p_thread * cull_total / total_threads;
cull_to = (p_thread + 1 == total_threads) ? cull_total : ((p_thread + 1) * cull_total / total_threads);
_scene_cull(cull_data, scene_cull_result_threads[p_thread], cull_from, cull_to);
}
for (InstanceCullResult &thread : scene_cull_result_threads) {
scene_cull_result.append_from(thread);
}
//single threaded
//_scene_cull(cull_data, scene_cull_result, cull_from, cull_to);
}
Another example project: |
Seems like PagedArray::merge_unordered called from RendererSceneCull::InstanceCullResult::append_from is responsible for this. It just skips a merge sometimes. In one go there are 22793 instances - which is correctly rendered. When split and merged the outcome is only 18697. Merge: 2 |
@bithunter32 It looks like in the threaded version the result buffers are cleared before using, while in your single-threaded version they are never cleared
|
@clayjohn that was just a short try. i restored the original code before i proceeded with testing. The original threaded code produces still a too short PagedArray. |
Godot version
4.0 RC1 dotnet
System information
Windows 10, Nvidia GTX 1660Ti, Vulkan
Issue description
I was, just out of curiosity, testing what performance godot can give with larger worlds with just default settings dropping lots of objects in so I made a pretty big map (in the example below it was about 50000 objects, I went up to 400000 after that), I understand that there are optimization steps such as MultiMesh or the particle system or GeometryShaders, I did NOT use any of these.
As you can see sometimes something glitches, I thought maybe it was an issues with not having properly set up shadow map or something but in the video editor I noticed that some meshes jsut completely disappear. I'm not sure if this is an actual bug or maybe just my computer not being strong enough to handle this? (the scene was running at smooth 60 fps).
I also tried this on a smaller scene with couple hundreds objects but I had no issues there, I have them only when I add large number of objects.
It also doesn't seem to be an issues of distance since it happens to both distant objects as well as nearby ones. In the video you can see I even jump to increase the distance with objects below but they get back to normal when I move.
It also happens only at certain camera angles I guess (or at least it seems to be related to a camera angle or some world positions?).
I'm sorry if this is not an issues I wasn't sure if this is worth a report or if this is just my HW?
Please check the entire video below, I've also took couple screenshots to showcase what exactly happens because some of these happen in just a frame or so (in a video editing program I've took screenshots of exact moments of the issues).
Video: https://youtu.be/63NRSsudxu0 (check timestamps)
Images:
Issues apparent in the distance (long grea area from left to right) and meshes disappear in the bottom right corner.
Well lots of meshes disappeared, compared to the video if needed it's the last couple seconds)
Well lots of meshes disappeared, compared to the video if needed it's the last couple seconds)
Steps to reproduce
Using Minimal Reproduction Project:
(rows * columns) * 3 * 1.5
, the current 325 is about 400k objects!)(In your own custom project: Add lots of objects to the scene and move around, observe what was in the video.)
Minimal reproduction project
LotsObjectsGlitchRepro.zip
Video from minimal repro project: https://youtu.be/Hi9m2Q-kAcY
(At the beginning there's just couple frames showcasing it happening in other parts of the world but you have to pause the video and really just move frame by frame to see these, the second part of the video shows the saved location you can get to with CTRL + E)
The text was updated successfully, but these errors were encountered: