Inspirateur / riverbed

A Minecraft-inspired Bevy game
MIT License
17 stars 0 forks source link

LOD remeshing system is flawed and can leave some chunks unmeshed #9

Closed Inspirateur closed 3 months ago

Inspirateur commented 3 months ago

Just copy pasting the comment I left in the relevant system

fn mark_lod_remesh(
    load_area: Res<LoadArea>, 
    chunk_ents: ResMut<ChunkEntities>, 
    lods: Query<&LOD>, 
    blocks: ResMut<Blocks>
) {
    // FIXME: this only remesh chunks that previously had a mesh 
    // However in some rare cases a chunk with some blocs can produce an empty mesh at certain LODs 
    // and never get remeshed even though it should

An easy solution is to instanciate all chunk meshes even if they are empty, but the ChunkEntities map feels bad, it would be good to use something better ...

Prime example here: image

Inspirateur commented 3 months ago

I went for the easy solution of just instancing all meshes even the empty one and it works, i don't think it adds too much cost because these meshes are very rare and it certainly doesn't add complexity since I juste removed an early return. It's a pretty good solution for now :)