Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.68k stars 251 forks source link

Unexpected holes and triangle patches when loading the editd blocks #691

Closed lenesxy closed 1 month ago

lenesxy commented 2 months ago

When applicable, please describe your setup:

I used the left mouse button to edit the Earth while flying the ship. When exiting the editor and re-flying near the edited area, the problem documented in the video was discovered.

Edited Earth solar_system_demo-master/debug_data/Earth.sqlite Earth.zip

Video Link https://youtu.be/AUoK_OG9IVQ

Zireael07 commented 2 months ago

Comment above is a spam, links have been determined to be malware

Zireael07 commented 2 months ago

... another one shows up

MGilleronFJ commented 2 months ago

Any errors in the console? (not just when reopening, but when playing the first session as well)

Also, how did you quit the game? Keep in mind if you use Godot's Stop button, saving can break.

lenesxy commented 2 months ago

Any errors in the console? (not just when reopening, but when playing the first session as well)

Also, how did you quit the game? Keep in mind if you use Godot's Stop button, saving can break.

These are the errors reported by the Godot editor when opening the project:

--- Debug adapter server started on port 6006 ---
--- GDScript language server started on port 6005 ---
  res://addons/gdquest.mannequin/src/Player/Camera/States/Aim.gd:41 - Parse Error: Could not resolve external class member "camera".
  modules\gdscript\gdscript.cpp:2936 - Failed to load script "res://addons/gdquest.mannequin/src/Player/Camera/States/Aim.gd" with error "Parse error". (User)
  res://addons/gdquest.mannequin/src/Player/Camera/CameraRig.gd:9 - Parse Error: Could not parse global class "InterpolatedCamera3D" from "res://addons/interpolated_camera_3d/interpolated_camera_3d.gd".
  res://addons/gdquest.mannequin/src/Player/Camera/CameraState.gd:-1 - Compile Error: 
  res://addons/gdquest.mannequin/src/Player/Camera/States/Camera.gd:-1 - Compile Error: 
  modules\gdscript\gdscript.cpp:2936 - Failed to load script "res://addons/gdquest.mannequin/src/Player/Camera/States/Camera.gd" with error "Parse error". (User)
  res://addons/gdquest.mannequin/src/Player/Camera/CameraRig.gd:9 - Parse Error: Could not parse global class "InterpolatedCamera3D" from "res://addons/interpolated_camera_3d/interpolated_camera_3d.gd".
  res://addons/gdquest.mannequin/src/Player/Player.gd:-1 - Compile Error: 
  res://addons/gdquest.mannequin/src/Player/PlayerState.gd:-1 - Compile Error: 
  res://addons/gdquest.mannequin/src/Player/Camera/CameraRig.gd:9 - Parse Error: Could not parse global class "InterpolatedCamera3D" from "res://addons/interpolated_camera_3d/interpolated_camera_3d.gd".
  res://addons/gdquest.mannequin/src/Player/States/Extensions/Zip.gd:-1 - Compile Error: 
  modules\gdscript\gdscript.cpp:2936 - Failed to load script "res://addons/gdquest.mannequin/src/Player/States/Extensions/Zip.gd" with error "Parse error". (User)

And no console errors when Running The Project. I remember exiting with the “Exit to menu” button after editing and then closing the editor. I'm going to try a few more times.

lenesxy commented 2 months ago

I tried again(Revert the Earth.sqlite and re-edit). This time i did not quit the game(Just run the project and then fly and edit). The problem can be reproduced.

Screenshot 3

lenesxy commented 2 months ago

Btw I disable the volume.full_load_mode_enabled in _setup_rocky_planet() of res://solar_system/solar_system_setup.gd

#volume.full_load_mode_enabled = true
MGilleronFJ commented 2 months ago

These are the errors reported by the Godot editor when opening the project:

These errors can be ignored, the mannequin addon is not used currently.

Btw I disable the volume.full_load_mode_enabled

While this is not supposed to cause issues, it is not something the demo was tuned with. Turning this off pretty much enables data streaming, which will impair some features of the demo such as detail rendering, the ability to edit further away, and loading speed.

Before using this demo, have you tried using VoxelLodTerrain with a generator and VoxelStreamSQLite in a basic project, to see if it also happens there?

lenesxy commented 2 months ago

Before using this demo, have you tried using VoxelLodTerrain with a generator and VoxelStreamSQLite in a basic project, to see if it also happens there?

I was just introduced to Godot and this voxel module two days ago and don't yet know how to generate planets using VoxelLodTerrain and VoxelStreamSQLite, so I haven't tried it yet. I will try it when I know how to use it.

MGilleronFJ commented 2 months ago

I tried making a test project where I dig a hole, then move away then come back closer, but I could not reproduce the issue... Here is the project: VoxelIssue691.zip

If you manage to reproduce this in a minimal test project, it would help a lot.

Some notes: if you make a minimal project and your reproduction involves quitting the game and launching it back, keep in mind edited chunks don't automatically save if you don't move away from them before quitting. The solar system demo and the project above have some code to deal with this. See https://voxel-tools.readthedocs.io/en/latest/streams/

lenesxy commented 2 months ago

I tried making a test project where I dig a hole, then move away then come back closer, but I could not reproduce the issue... Here is the project: VoxelIssue691.zip

I could not reproduce the issue use your project either.

I will try to simplify the solar system demo to reproduce the issue

MGilleronFJ commented 2 months ago

Btw I disable the volume.full_load_mode_enabled in _setup_rocky_planet() of res://solar_system/solar_system_setup.gd

Have you done any other changes? I was able to reproduce the issue in my local version, however it is specifically because I had the streaming sytem set to Clipbox. Octree is what the demo uses by default and would not be affected by it.

The reproduction steps I used were very precise: Make sure there is no save, launch the game, fly to earth, dig a hole, fly away until earth fits the screen, fly back in, land next to the hole (at this point there is no issue visible yet), then open the pause menu and "exit to OS". Then launch the game again, fly to the same location and observe issues. Alternatively, another symptom already visible before launching the game again, is that the SQLite file didn't contain any saved block at LOD 1, while it is expected to find blocks of every LOD with inversely exponential amounts. Coordinate patterns also hinted that some blocks were saved with the wrong LOD index (can be checked with a DB viewing app).

I checked your Earth.sqlite file but it doesnt appear to have that issue on a first glance. So if there is another bug leading to similar symptoms, its reproduction steps need to be found.

Note that I haven't pushed fixes to what I found so far, so make sure you're not using Clipbox for now.

lenesxy commented 2 months ago

Btw I disable the volume.full_load_mode_enabled in _setup_rocky_planet() of res://solar_system/solar_system_setup.gd

Have you done any other changes? I was able to reproduce the issue in my local version, however it is specifically because I had the streaming sytem set to Clipbox. Octree would not be affected by it.

Previously I tried both Octree and Clipbox to reproduce this in SolarSystemDemo, only modifying full_load_mode_enabled and the ship's controls (So that it can be stopped when there is no input). Not very easy to see this phenomenon. I had other things going on today and haven't created any other test projects yet.

MGilleronFJ commented 2 months ago

There is another issue that would affect both systems, which would also print this warning: https://github.com/Zylann/godot_voxel/blob/3a9775f6fc45f2475c8a9e487885859bc9abed99/storage/voxel_buffer.cpp#L200 However you said you had no errors, you might check warnings too. Also I don't have repro for this one, maybe you didn't hit it, I just happened to come across it. I'll push fixes for what I found so far later.

Zylann commented 2 months ago

Pushed some fixes that may (or may not) affect your reproduction attempts:

lenesxy commented 2 months ago

Pushed some fixes that may (or may not) affect your reproduction attempts:

I will pull these and try again

lenesxy commented 2 months ago

Pushed some fixes that may (or may not) affect your reproduction attempts:

After pulling these fixes I tried again for a few hours and the problem did not recur