Conversation
|
Needs a rebase again. :( |
|
@lhofhansl no need to be sorry. And even then, Id probably try to get this feature complete before trying to resolve the merge conflicts. So, If anyone has input on how to do any of these, or if they are even feasible/necessary, let me know:
|
|
First we need the necessary "infrastructure" for any kind of LODs to be implemented, something like described here: #15172 (comment) |
…x_hull 5.15.0 # Conflicts: # shell.nix # src/client/mapblock_mesh.cpp
…mono mats wouldnt know if it would have to be reflective or not
removed generateMonoMesh as its become obsolete
|
Are distant mapblocks still simplified to cubes as in the OP's screenshot? |
What do you mean by triangulated planes? I did try less blocky approaches before, but they were bothersome. One approach was splitting the chunk into smaller segments for which I then generated convex hulls (thats why the branch im merging from is still called that). But I dont think they would be more efficient. On paper? Yes. But in practice, I doubt that it would make much of a difference. Especially if you look at the vram graph, the closer non-lod blocks make up most of the vertex count anyway. |
Well, sticking with the simpler solution that works is probably better then. Thanks for clarification. |
Probably, yeah. Even if there is more stuff that could be done, it's better to leave the rest (pointclouds? etc.) for future PRs (assuming this one goes well). |
…ex_hull # Conflicts: # client/shaders/nodes_shader/opengl_fragment.glsl # src/client/shader.cpp # src/client/shader.h

This PR draft adds basic LOD mesh generation.
It works by changing how a mapblock mesh is generated depending on the distance to the player. Only certain node types are included in LOD generation, so for example plantlikes are not rendered. The allowed nodes are then used for a greedy mesher to further reduce vertex counts. The less detailed the LOD, the fewer node samples are used for mesh generation.
After a certain threshold, the mesh is rendered with only one material, without a texture to reduce material swaps.
The threshold after which LODs should be used, the rate at which LOD level increases, and the threshold for textureless mesh generation are configurable in the settings.
The LOD mesh generation is significantly faster than regular mesh generation, on less detailed meshes. The meshes also use considerably less RAM, since their vertex count is a lot smaller. The LODs also yield a performance improvement in my testing.
I redid this benchmark now, with 5.15 merged.
These stats were gathered by standing still in a pre-emerged world with 4000 node render and send distance, and a mesh chunk size of 16, for 15 minutes. They show how these system resources change over time or as more chunks get generated. The lod settings had a threshold of 15 blocks, a quality of 2, and a texture threshold of 2.
To do
This PR is a Work in Progress
To do maybe
Add a new kind of vertex. Since the LODs are always exactly grid aligned and are always cuboid, they wouldnt need 9 f32 fields for their position, size, and normal per vertex. The textureless meshes also wouldnt need any uv information.Pre-generate multiple LODs at once, to easily swap between them when a player moves closer to or further away from a certain chunk or uses the zoom function.Persist the meshes client side, so they can be loaded immediately upon loading a world. (Might be impossible due to mesh chunk size possibly changing or when playing on servers.)How to test
These are not very detailed instructions since there are so many different combinations of nodes and settings.