Data Aligned CLOD

Godot Version

4.6.2

This is DACLOD, Data Aligned Chunked Level Of Detail. The idea comes from the fact that GPU’s

work best with power of 2 textures, like 256, 512, 1024 etc.

DarkGrey456/SLICED-BREAD-DACLOD-

Ordinary Chunked LOD usually uses textures with 1 extra pixel beyond the power of 2 boundary, and the meshes are organized to overlap at the seams … this is different, there is no overlap, the meshes just line up, they have power of 2 vertices, and they read from power of 2 textures.

The meshes are set up with visibility fading - so the visibility range in the editor actually controls which mesh is visible. They are a GLB that I created myself in Blender. The actual rendering method is my completely original modification of the original chunked lod (Thatcher Ulrich)- it uses the GPU to simply displace the vertices of the mesh instances, and the CPU generates collisions and AABB’s at the beginning. And of course they are data aligned - if you subdivide a plan in blender then 2 subdivisions makes 4 vertices, 4 subdivisions makes 6 etc … so I made meshes with 16x16, 32x32, 64x64, 128x128, 256x256. The actual tiles take up the same space, so they do not subdivide like a quad tree … instead I display the lower res tile at a distance at the same scale. They downsample the height texture with no visible popping.

At the moment there is a long winded phase at the beginning where I compute the AABB and the Occlusion shapes (not currently used) and Collision model. This will hopefully become an editor only feature and then I will save the data to a permanent location and then reload each time the game is run.

The terrain wont be visible until the you run the scene, then theres a waiting time … and then at first the chunks look a bit weird until you move the camera … w to fly forward, s to fly back.

Sharing this here because its the fastest Terrain system I have ever used.

2 Likes

Also if you wanted to import your own 4k heightmap (4096) then you need to make sure its not using compression - otherwise there is a staircase effect as the image will be quantized. Check the import settings for the heightmap used in the addon. There are numerous nuances to this sort of thing.

I was experimenting with mip maps but I think its best if they are not active as the meshes would need a custom mip level and range.

1 Like

Update on github:

I have improved the collision model and the loading time. I now use a function adapted from SimpleTerrain to generate the collider, and the system for creating AABB’s no longer generates an unused mesh - I have also put the occluders back into the scene.

Next update will be pixel shaders, normals, shadows (suffering from Shadow Acne atm) etc so the frame rate should drop back to sane levels (from 250 fps on my computer).

Sliced bread (DACLOD) has some enhancements …

  1. advanced bump normal and vertex displacement shader

  2. shadow casting

  3. the “skirts” have been removed, they were included as they were the fix in original Chunked LOD. Now the vertex count really is 128 x 128 for example.

  4. The meshes were all redone to ensure they had the correct number of vertices.

The FPS is lower, but higher than it was when I used the shaders on the version with the skirts.

The skirts were messing up the normals at the seams slightly.

If you want the terrain normal map you can easily make it in GIMP or Krita.

1 Like