-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
Redrawing occasionally shows brief holes in the terrain #57
Comments
I suspect this is happening because the edit you made is intersecting more than one block. In the worst case, there are 8 blocks to remesh if you do this at an intersection. Because that's an asynchronous process, the re-meshed results aren't guaranteed to come back at the same frame. So you will see through the terrain for a very brief moment. It is more likely to happen if the process of meshing and creating the Mesh resources takes longer than a frame. No mesh get deleted here (to my knowledge at least). The holes are just the consequence of seeing removed voxels in one mesh, but the neighbor mesh hasn't been updated yet so you are seeing its insides. I think this is also happening in Minecraft, especially when using TNT. Something we could try to minimize this would be to set request batching to |
Using the VoxelTool::do_sphere in C++ has reduced artifacting significantly at a sphere radius of 3.5. However at a radius of 10.5, which isn't huge, it is very common and obvious. |
At such a large radius it becomes really hard to expect this to not happen. radius of 10 can span across 3x3x3 blocks (27) which would all have to complete remeshing during a single frame. |
LOD terrain has a limitation of how large the edited area is, because you can only edit within a margin of LOD0. |
I have this same issue even when destroying just one block at a time in blocky terrain. Would it be possible to run the mesher first as if the blocks that are supposed to be destroyed were like transparent blocks where other faces get rendered behind first? |
Destroying a block is instant. There is no "first" to speak of. You could only do that kind of workaround if it took time to destroy, which introduces complexity which you could handle in game logic. Otherwise, so far I really haven't a generic fix for this issue that doesn't come with drawbacks. When destroying single blocks It's possible to make it less likely to happen but latency issues will come up as I described here #57 (comment). godot_voxel/terrain/voxel_terrain.cpp Line 14 in a24b33e
With more blocks being destroyed it's much harder to avoid. It's also worth noting that Minetest and Minecraft still have the same problem to this day, which is partly covered with smoke particles. If you just want to cover up the case of single blocks being removed, game logic solutions described above sound like less trouble. |
I like the idea of replacing the block with a MeshInstance cube for one frame. Anyway this gives me some ideas for things to try. Thanks |
Often when modifying a terrain, an update draws an artifact that breaks the illusion of being deep inside the terrain. It's quick, but not imperceptible even at high framerates. If you turn on vsync and/or multithreading the redraw speed is slower and they are even more noticeable.
In all three examples below, I'm digging deep into a mountain, yet one frame shows light peeking through, then it disappears. In the first example, this might have happened on two sections simultaneously. Most edits draw fine, but I could reproduce the artifact in less than a minute.
It only occurs during the redraw of the edit. Once the edit completes it's fine. It's like it deletes the mesh, then gets hung up long enough for the renderer to draw the frame as is, then finally creates the new mesh in the next frame.
If you want to see it, you'll probably want to use my demo (in my PR) so you can test high amounts of changes. I've been regularly updating it and it does a pretty good job of keeping the camera within the terrain. See the readme for controls, but right-click destroys terrain.
The text was updated successfully, but these errors were encountered: