BramStoutProductions / MiEx

A modern Minecraft Exporter
BSD 3-Clause "New" or "Revised" License
50 stars 6 forks source link

New Cave Removal #46

Closed Fyoncle closed 1 month ago

Fyoncle commented 2 months ago

Maybe cave removal algorithm can have a feature to avoid few blocks from the foreground, like if we select "3" cave revomal will start after 3 blocks from foreground, in this case we can prevent modded leaves making see-through leaves so easily!

BramStout commented 2 months ago

Just to clarify, is the issue here that modded leaves end up occluding other blocks, creating holes in the world that you can see through, like in this image? image

If so, the issue isn't with the cave removal algorithm. You'd still get it even with it turned off. It might be less noticeable, but it's still there.

The actual issue is that you need to tell MiEx that certain blocks are leaves or transparent and thus shouldn't occlude other blocks, so that they don't create these holes in the world. You do this in the miex_config.json file. In the resource pack for your modpack, you can create a file called miex_config.json and in there tell MiEx how to handle certain blocks in special ways.

Here is an example miex_config.json file that tells MiEx how to handle some Regions Unexplored blocks:

{
    "leavesOcclusion.add": [ "regions_unexplored:willow_leaves", "regions_unexplored:white_magnolia_leaves",
                            "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves",
                            "regions_unexplored:silver_birch_leaves", "regions_unexplored:redwood_leaves",
                            "regions_unexplored:red_maple_leaves", "regions_unexplored:pink_magnolia_leaves",
                            "regions_unexplored:pine_leaves", "regions_unexplored:palm_leaves",
                            "regions_unexplored:orange_maple_leaves", "regions_unexplored:mauve_leaves",
                            "regions_unexplored:maple_leaves", "regions_unexplored:magnolia_leaves",
                            "regions_unexplored:larch_leaves", "regions_unexplored:kapok_leaves",
                            "regions_unexplored:joshua_leaves", "regions_unexplored:golden_larch_leaves",
                            "regions_unexplored:flowering_leaves", "regions_unexplored:eucalyptus_leaves",
                            "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:dead_pine_leaves",
                            "regions_unexplored:dead_leaves", "regions_unexplored:cypress_leaves",
                            "regions_unexplored:brimwood_leaves", "regions_unexplored:blue_magnolia_leaves",
                            "regions_unexplored:blackwood_leaves", "regions_unexplored:baobab_leaves",
                            "regions_unexplored:bamboo_log_leaves", "regions_unexplored:bamboo_leaves",
                            "regions_unexplored:ashen_leaves", "regions_unexplored:apple_oak_leaves",
                            "regions_unexplored:alpha_leaves"],
    "grassColormapBlocks.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:clover", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:kapok_vines", "regions_unexplored:maple_leave_pile", "regions_unexplored:medium_grass", "regions_unexplored:ru_grass_block",
        "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ],
    "foliageColormapBlocks.add": [
        "regions_unexplored:apple_oak_leaves", "regions_unexplored:bamboo_log_leaves", "regions_unexplored:cypress_leaves",
        "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:eucalyptus_leaves", "regions_unexplored:joshua_leaves",
        "regions_unexplored:kapok_leaves", "regions_unexplored:magnolia_leaves", "regions_unexplored:maple_leaves",
        "regions_unexplored:orange_maple_leaves", "regions_unexplored:palm_leaves", "regions_unexplored:pine_leaves",
        "regions_unexplored:red_maple_leaves", "regions_unexplored:redwood_leaves", "regions_unexplored:silver_birch_leaves",
        "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves", "regions_unexplored:white_magnolia_leaves",
        "regions_unexplored:willow_leaves"
    ],
    "doubleSided.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:medium_grass", "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ]
}

You can add all of the leaves blocks to the leavesOcclusion.add list and all of the other transparent blocks to the transparentOcclusion.add list. The .add tells MiEx to add these blocks to the existing list of blocks rather than override the entire list.

You can also see that the example miex_config.json file also informs MiEx about blocks that need biome colours.

I know that this can be tedious to do, so in the next release of MiEx, I'll update the "Extract Mod Resource Pack" tool to try to produce a miex_config.json file as best as it can. It might miss a few things or get a few things wrong, but most should then be in there. The next release should come somewhere this week.

Fyoncle commented 2 months ago

Just to clarify, is the issue here that modded leaves end up occluding other blocks, creating holes in the world that you can see through, like in this image? image

If so, the issue isn't with the cave removal algorithm. You'd still get it even with it turned off. It might be less noticeable, but it's still there.

The actual issue is that you need to tell MiEx that certain blocks are leaves or transparent and thus shouldn't occlude other blocks, so that they don't create these holes in the world. You do this in the miex_config.json file. In the resource pack for your modpack, you can create a file called miex_config.json and in there tell MiEx how to handle certain blocks in special ways.

Here is an example miex_config.json file that tells MiEx how to handle some Regions Unexplored blocks:

{
    "leavesOcclusion.add": [ "regions_unexplored:willow_leaves", "regions_unexplored:white_magnolia_leaves",
                            "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves",
                            "regions_unexplored:silver_birch_leaves", "regions_unexplored:redwood_leaves",
                            "regions_unexplored:red_maple_leaves", "regions_unexplored:pink_magnolia_leaves",
                            "regions_unexplored:pine_leaves", "regions_unexplored:palm_leaves",
                            "regions_unexplored:orange_maple_leaves", "regions_unexplored:mauve_leaves",
                            "regions_unexplored:maple_leaves", "regions_unexplored:magnolia_leaves",
                            "regions_unexplored:larch_leaves", "regions_unexplored:kapok_leaves",
                            "regions_unexplored:joshua_leaves", "regions_unexplored:golden_larch_leaves",
                            "regions_unexplored:flowering_leaves", "regions_unexplored:eucalyptus_leaves",
                            "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:dead_pine_leaves",
                            "regions_unexplored:dead_leaves", "regions_unexplored:cypress_leaves",
                            "regions_unexplored:brimwood_leaves", "regions_unexplored:blue_magnolia_leaves",
                            "regions_unexplored:blackwood_leaves", "regions_unexplored:baobab_leaves",
                            "regions_unexplored:bamboo_log_leaves", "regions_unexplored:bamboo_leaves",
                            "regions_unexplored:ashen_leaves", "regions_unexplored:apple_oak_leaves",
                            "regions_unexplored:alpha_leaves"],
    "grassColormapBlocks.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:clover", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:kapok_vines", "regions_unexplored:maple_leave_pile", "regions_unexplored:medium_grass", "regions_unexplored:ru_grass_block",
        "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ],
    "foliageColormapBlocks.add": [
        "regions_unexplored:apple_oak_leaves", "regions_unexplored:bamboo_log_leaves", "regions_unexplored:cypress_leaves",
        "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:eucalyptus_leaves", "regions_unexplored:joshua_leaves",
        "regions_unexplored:kapok_leaves", "regions_unexplored:magnolia_leaves", "regions_unexplored:maple_leaves",
        "regions_unexplored:orange_maple_leaves", "regions_unexplored:palm_leaves", "regions_unexplored:pine_leaves",
        "regions_unexplored:red_maple_leaves", "regions_unexplored:redwood_leaves", "regions_unexplored:silver_birch_leaves",
        "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves", "regions_unexplored:white_magnolia_leaves",
        "regions_unexplored:willow_leaves"
    ],
    "doubleSided.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:medium_grass", "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ]
}

You can add all of the leaves blocks to the leavesOcclusion.add list and all of the other transparent blocks to the transparentOcclusion.add list. The .add tells MiEx to add these blocks to the existing list of blocks rather than override the entire list.

You can also see that the example miex_config.json file also informs MiEx about blocks that need biome colours.

I know that this can be tedious to do, so in the next release of MiEx, I'll update the "Extract Mod Resource Pack" tool to try to produce a miex_config.json file as best as it can. It might miss a few things or get a few things wrong, but most should then be in there. The next release should come somewhere this week.

But that is too much work, a system like i said would be way better and practical.

BramStout commented 2 months ago

Just to clarify, is the issue here that modded leaves end up occluding other blocks, creating holes in the world that you can see through, like in this image? image If so, the issue isn't with the cave removal algorithm. You'd still get it even with it turned off. It might be less noticeable, but it's still there. The actual issue is that you need to tell MiEx that certain blocks are leaves or transparent and thus shouldn't occlude other blocks, so that they don't create these holes in the world. You do this in the miex_config.json file. In the resource pack for your modpack, you can create a file called miex_config.json and in there tell MiEx how to handle certain blocks in special ways. Here is an example miex_config.json file that tells MiEx how to handle some Regions Unexplored blocks:

{
    "leavesOcclusion.add": [ "regions_unexplored:willow_leaves", "regions_unexplored:white_magnolia_leaves",
                            "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves",
                            "regions_unexplored:silver_birch_leaves", "regions_unexplored:redwood_leaves",
                            "regions_unexplored:red_maple_leaves", "regions_unexplored:pink_magnolia_leaves",
                            "regions_unexplored:pine_leaves", "regions_unexplored:palm_leaves",
                            "regions_unexplored:orange_maple_leaves", "regions_unexplored:mauve_leaves",
                            "regions_unexplored:maple_leaves", "regions_unexplored:magnolia_leaves",
                            "regions_unexplored:larch_leaves", "regions_unexplored:kapok_leaves",
                            "regions_unexplored:joshua_leaves", "regions_unexplored:golden_larch_leaves",
                            "regions_unexplored:flowering_leaves", "regions_unexplored:eucalyptus_leaves",
                            "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:dead_pine_leaves",
                            "regions_unexplored:dead_leaves", "regions_unexplored:cypress_leaves",
                            "regions_unexplored:brimwood_leaves", "regions_unexplored:blue_magnolia_leaves",
                            "regions_unexplored:blackwood_leaves", "regions_unexplored:baobab_leaves",
                            "regions_unexplored:bamboo_log_leaves", "regions_unexplored:bamboo_leaves",
                            "regions_unexplored:ashen_leaves", "regions_unexplored:apple_oak_leaves",
                            "regions_unexplored:alpha_leaves"],
    "grassColormapBlocks.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:clover", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:kapok_vines", "regions_unexplored:maple_leave_pile", "regions_unexplored:medium_grass", "regions_unexplored:ru_grass_block",
        "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ],
    "foliageColormapBlocks.add": [
        "regions_unexplored:apple_oak_leaves", "regions_unexplored:bamboo_log_leaves", "regions_unexplored:cypress_leaves",
        "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:eucalyptus_leaves", "regions_unexplored:joshua_leaves",
        "regions_unexplored:kapok_leaves", "regions_unexplored:magnolia_leaves", "regions_unexplored:maple_leaves",
        "regions_unexplored:orange_maple_leaves", "regions_unexplored:palm_leaves", "regions_unexplored:pine_leaves",
        "regions_unexplored:red_maple_leaves", "regions_unexplored:redwood_leaves", "regions_unexplored:silver_birch_leaves",
        "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves", "regions_unexplored:white_magnolia_leaves",
        "regions_unexplored:willow_leaves"
    ],
    "doubleSided.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:medium_grass", "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ]
}

You can add all of the leaves blocks to the leavesOcclusion.add list and all of the other transparent blocks to the transparentOcclusion.add list. The .add tells MiEx to add these blocks to the existing list of blocks rather than override the entire list. You can also see that the example miex_config.json file also informs MiEx about blocks that need biome colours. I know that this can be tedious to do, so in the next release of MiEx, I'll update the "Extract Mod Resource Pack" tool to try to produce a miex_config.json file as best as it can. It might miss a few things or get a few things wrong, but most should then be in there. The next release should come somewhere this week.

But that is too much work, a system like i said would be way better and practical.

Assuming that the issue is modded leaves creates holes in the world, then such a system would not fix this. The entire issue is that MiEx assumes that the leaves are solid blocks by default, unless you tell it that it's not. And because MiEx thinks the leaves blocks are solid, they will occlude other blocks, thus creating the holes in the world that you see.

The only actual fix is to tell MiEx that these blocks are leaves, which is done in the miex_config.json file. But this is why I indicated that for the next release of MiEx, I'll update the "Extract Mod Resource Pack" tool to create a miex_config.json for you.

Fyoncle commented 2 months ago

Just to clarify, is the issue here that modded leaves end up occluding other blocks, creating holes in the world that you can see through, like in this image? image If so, the issue isn't with the cave removal algorithm. You'd still get it even with it turned off. It might be less noticeable, but it's still there. The actual issue is that you need to tell MiEx that certain blocks are leaves or transparent and thus shouldn't occlude other blocks, so that they don't create these holes in the world. You do this in the miex_config.json file. In the resource pack for your modpack, you can create a file called miex_config.json and in there tell MiEx how to handle certain blocks in special ways. Here is an example miex_config.json file that tells MiEx how to handle some Regions Unexplored blocks:

{
    "leavesOcclusion.add": [ "regions_unexplored:willow_leaves", "regions_unexplored:white_magnolia_leaves",
                            "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves",
                            "regions_unexplored:silver_birch_leaves", "regions_unexplored:redwood_leaves",
                            "regions_unexplored:red_maple_leaves", "regions_unexplored:pink_magnolia_leaves",
                            "regions_unexplored:pine_leaves", "regions_unexplored:palm_leaves",
                            "regions_unexplored:orange_maple_leaves", "regions_unexplored:mauve_leaves",
                            "regions_unexplored:maple_leaves", "regions_unexplored:magnolia_leaves",
                            "regions_unexplored:larch_leaves", "regions_unexplored:kapok_leaves",
                            "regions_unexplored:joshua_leaves", "regions_unexplored:golden_larch_leaves",
                            "regions_unexplored:flowering_leaves", "regions_unexplored:eucalyptus_leaves",
                            "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:dead_pine_leaves",
                            "regions_unexplored:dead_leaves", "regions_unexplored:cypress_leaves",
                            "regions_unexplored:brimwood_leaves", "regions_unexplored:blue_magnolia_leaves",
                            "regions_unexplored:blackwood_leaves", "regions_unexplored:baobab_leaves",
                            "regions_unexplored:bamboo_log_leaves", "regions_unexplored:bamboo_leaves",
                            "regions_unexplored:ashen_leaves", "regions_unexplored:apple_oak_leaves",
                            "regions_unexplored:alpha_leaves"],
    "grassColormapBlocks.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:clover", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:kapok_vines", "regions_unexplored:maple_leave_pile", "regions_unexplored:medium_grass", "regions_unexplored:ru_grass_block",
        "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ],
    "foliageColormapBlocks.add": [
        "regions_unexplored:apple_oak_leaves", "regions_unexplored:bamboo_log_leaves", "regions_unexplored:cypress_leaves",
        "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:eucalyptus_leaves", "regions_unexplored:joshua_leaves",
        "regions_unexplored:kapok_leaves", "regions_unexplored:magnolia_leaves", "regions_unexplored:maple_leaves",
        "regions_unexplored:orange_maple_leaves", "regions_unexplored:palm_leaves", "regions_unexplored:pine_leaves",
        "regions_unexplored:red_maple_leaves", "regions_unexplored:redwood_leaves", "regions_unexplored:silver_birch_leaves",
        "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves", "regions_unexplored:white_magnolia_leaves",
        "regions_unexplored:willow_leaves"
    ],
    "doubleSided.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:medium_grass", "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ]
}

You can add all of the leaves blocks to the leavesOcclusion.add list and all of the other transparent blocks to the transparentOcclusion.add list. The .add tells MiEx to add these blocks to the existing list of blocks rather than override the entire list. You can also see that the example miex_config.json file also informs MiEx about blocks that need biome colours. I know that this can be tedious to do, so in the next release of MiEx, I'll update the "Extract Mod Resource Pack" tool to try to produce a miex_config.json file as best as it can. It might miss a few things or get a few things wrong, but most should then be in there. The next release should come somewhere this week.

But that is too much work, a system like i said would be way better and practical.

Assuming that the issue is modded leaves creates holes in the world, then such a system would not fix this. The entire issue is that MiEx assumes that the leaves are solid blocks by default, unless you tell it that it's not. And because MiEx thinks the leaves blocks are solid, they will occlude other blocks, thus creating the holes in the world that you see.

The only actual fix is to tell MiEx that these blocks are leaves, which is done in the miex_config.json file. But this is why I indicated that for the next release of MiEx, I'll update the "Extract Mod Resource Pack" tool to create a miex_config.json for you.

So its not possible to have a cave removal feature that starts the removal few blocks later from foreground?

BramStout commented 2 months ago

Just to clarify, is the issue here that modded leaves end up occluding other blocks, creating holes in the world that you can see through, like in this image? image If so, the issue isn't with the cave removal algorithm. You'd still get it even with it turned off. It might be less noticeable, but it's still there. The actual issue is that you need to tell MiEx that certain blocks are leaves or transparent and thus shouldn't occlude other blocks, so that they don't create these holes in the world. You do this in the miex_config.json file. In the resource pack for your modpack, you can create a file called miex_config.json and in there tell MiEx how to handle certain blocks in special ways. Here is an example miex_config.json file that tells MiEx how to handle some Regions Unexplored blocks:

{
    "leavesOcclusion.add": [ "regions_unexplored:willow_leaves", "regions_unexplored:white_magnolia_leaves",
                            "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves",
                            "regions_unexplored:silver_birch_leaves", "regions_unexplored:redwood_leaves",
                            "regions_unexplored:red_maple_leaves", "regions_unexplored:pink_magnolia_leaves",
                            "regions_unexplored:pine_leaves", "regions_unexplored:palm_leaves",
                            "regions_unexplored:orange_maple_leaves", "regions_unexplored:mauve_leaves",
                            "regions_unexplored:maple_leaves", "regions_unexplored:magnolia_leaves",
                            "regions_unexplored:larch_leaves", "regions_unexplored:kapok_leaves",
                            "regions_unexplored:joshua_leaves", "regions_unexplored:golden_larch_leaves",
                            "regions_unexplored:flowering_leaves", "regions_unexplored:eucalyptus_leaves",
                            "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:dead_pine_leaves",
                            "regions_unexplored:dead_leaves", "regions_unexplored:cypress_leaves",
                            "regions_unexplored:brimwood_leaves", "regions_unexplored:blue_magnolia_leaves",
                            "regions_unexplored:blackwood_leaves", "regions_unexplored:baobab_leaves",
                            "regions_unexplored:bamboo_log_leaves", "regions_unexplored:bamboo_leaves",
                            "regions_unexplored:ashen_leaves", "regions_unexplored:apple_oak_leaves",
                            "regions_unexplored:alpha_leaves"],
    "grassColormapBlocks.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:clover", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:kapok_vines", "regions_unexplored:maple_leave_pile", "regions_unexplored:medium_grass", "regions_unexplored:ru_grass_block",
        "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ],
    "foliageColormapBlocks.add": [
        "regions_unexplored:apple_oak_leaves", "regions_unexplored:bamboo_log_leaves", "regions_unexplored:cypress_leaves",
        "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:eucalyptus_leaves", "regions_unexplored:joshua_leaves",
        "regions_unexplored:kapok_leaves", "regions_unexplored:magnolia_leaves", "regions_unexplored:maple_leaves",
        "regions_unexplored:orange_maple_leaves", "regions_unexplored:palm_leaves", "regions_unexplored:pine_leaves",
        "regions_unexplored:red_maple_leaves", "regions_unexplored:redwood_leaves", "regions_unexplored:silver_birch_leaves",
        "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves", "regions_unexplored:white_magnolia_leaves",
        "regions_unexplored:willow_leaves"
    ],
    "doubleSided.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:medium_grass", "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ]
}

You can add all of the leaves blocks to the leavesOcclusion.add list and all of the other transparent blocks to the transparentOcclusion.add list. The .add tells MiEx to add these blocks to the existing list of blocks rather than override the entire list. You can also see that the example miex_config.json file also informs MiEx about blocks that need biome colours. I know that this can be tedious to do, so in the next release of MiEx, I'll update the "Extract Mod Resource Pack" tool to try to produce a miex_config.json file as best as it can. It might miss a few things or get a few things wrong, but most should then be in there. The next release should come somewhere this week.

But that is too much work, a system like i said would be way better and practical.

Assuming that the issue is modded leaves creates holes in the world, then such a system would not fix this. The entire issue is that MiEx assumes that the leaves are solid blocks by default, unless you tell it that it's not. And because MiEx thinks the leaves blocks are solid, they will occlude other blocks, thus creating the holes in the world that you see. The only actual fix is to tell MiEx that these blocks are leaves, which is done in the miex_config.json file. But this is why I indicated that for the next release of MiEx, I'll update the "Extract Mod Resource Pack" tool to create a miex_config.json for you.

So its not possible to have a cave removal feature that starts the removal few blocks later from foreground?

It's not really possible on a fundamental level, unfortunately, because MiEx cannot know where it should then add a face to get rid of the holes in the world without having to add in a tonne of unnecessary faces, unless you tell MiEx where it should add those faces, which you do with the miex_config.json file.

Most blocks are just cubes and have six faces. If you have two blocks next to each other, then you have two faces between the two blocks that you can't see. Because you can't see them, it would be very inefficient to still export and therefore try to render out those faces. So, MiEx (and Minecraft) gets rid of these faces between blocks. This is called occlusion culling in MiEx. However, in some cases you have blocks that are transparent (like leaves) and so you don't want to do this occlusion culling. If you still do the occlusion culling, then you get the result that you're seeing where you have holes in the world.

But how would MiEx know which blocks should occlude others and which shouldn't? This is why it needs to be specified in the miex_config.json file. If it just disables this occlusion culling close to the surface (which is what your idea would be doing), then it would just create whole bunch of unnecessary faces. The amount of faces would increase probably by over 10 times.

If you want to see what it could be like to have this occlusion culling turned off, you can enable the "Individual Blocks" checkbox in the top right of the window. Do make sure to only export a small section of your world, because it'll get really slow! This is what you'd then get: image Obviously it's all the way down, but even if it's limited to just the three closest blocks to the surface, you can still see that there would be a tonne of extra faces just slowing things down.

But again, for the next release of MiEx I'll try to automate generating the miex_config.json file so that you won't have to.

Fyoncle commented 2 months ago

Just to clarify, is the issue here that modded leaves end up occluding other blocks, creating holes in the world that you can see through, like in this image? image If so, the issue isn't with the cave removal algorithm. You'd still get it even with it turned off. It might be less noticeable, but it's still there. The actual issue is that you need to tell MiEx that certain blocks are leaves or transparent and thus shouldn't occlude other blocks, so that they don't create these holes in the world. You do this in the miex_config.json file. In the resource pack for your modpack, you can create a file called miex_config.json and in there tell MiEx how to handle certain blocks in special ways. Here is an example miex_config.json file that tells MiEx how to handle some Regions Unexplored blocks:

{
    "leavesOcclusion.add": [ "regions_unexplored:willow_leaves", "regions_unexplored:white_magnolia_leaves",
                            "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves",
                            "regions_unexplored:silver_birch_leaves", "regions_unexplored:redwood_leaves",
                            "regions_unexplored:red_maple_leaves", "regions_unexplored:pink_magnolia_leaves",
                            "regions_unexplored:pine_leaves", "regions_unexplored:palm_leaves",
                            "regions_unexplored:orange_maple_leaves", "regions_unexplored:mauve_leaves",
                            "regions_unexplored:maple_leaves", "regions_unexplored:magnolia_leaves",
                            "regions_unexplored:larch_leaves", "regions_unexplored:kapok_leaves",
                            "regions_unexplored:joshua_leaves", "regions_unexplored:golden_larch_leaves",
                            "regions_unexplored:flowering_leaves", "regions_unexplored:eucalyptus_leaves",
                            "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:dead_pine_leaves",
                            "regions_unexplored:dead_leaves", "regions_unexplored:cypress_leaves",
                            "regions_unexplored:brimwood_leaves", "regions_unexplored:blue_magnolia_leaves",
                            "regions_unexplored:blackwood_leaves", "regions_unexplored:baobab_leaves",
                            "regions_unexplored:bamboo_log_leaves", "regions_unexplored:bamboo_leaves",
                            "regions_unexplored:ashen_leaves", "regions_unexplored:apple_oak_leaves",
                            "regions_unexplored:alpha_leaves"],
    "grassColormapBlocks.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:clover", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:kapok_vines", "regions_unexplored:maple_leave_pile", "regions_unexplored:medium_grass", "regions_unexplored:ru_grass_block",
        "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ],
    "foliageColormapBlocks.add": [
        "regions_unexplored:apple_oak_leaves", "regions_unexplored:bamboo_log_leaves", "regions_unexplored:cypress_leaves",
        "regions_unexplored:enchanted_birch_leaves", "regions_unexplored:eucalyptus_leaves", "regions_unexplored:joshua_leaves",
        "regions_unexplored:kapok_leaves", "regions_unexplored:magnolia_leaves", "regions_unexplored:maple_leaves",
        "regions_unexplored:orange_maple_leaves", "regions_unexplored:palm_leaves", "regions_unexplored:pine_leaves",
        "regions_unexplored:red_maple_leaves", "regions_unexplored:redwood_leaves", "regions_unexplored:silver_birch_leaves",
        "regions_unexplored:socotra_leaves", "regions_unexplored:small_oak_leaves", "regions_unexplored:white_magnolia_leaves",
        "regions_unexplored:willow_leaves"
    ],
    "doubleSided.add": [
        "regions_unexplored:bladed_grass", "regions_unexplored:bladed_tall_grass", "regions_unexplored:elephant_ear_plant",
        "regions_unexplored:medium_grass", "regions_unexplored:steppe_grass", "regions_unexplored:steppe_tall_grass"
    ]
}

You can add all of the leaves blocks to the leavesOcclusion.add list and all of the other transparent blocks to the transparentOcclusion.add list. The .add tells MiEx to add these blocks to the existing list of blocks rather than override the entire list. You can also see that the example miex_config.json file also informs MiEx about blocks that need biome colours. I know that this can be tedious to do, so in the next release of MiEx, I'll update the "Extract Mod Resource Pack" tool to try to produce a miex_config.json file as best as it can. It might miss a few things or get a few things wrong, but most should then be in there. The next release should come somewhere this week.

But that is too much work, a system like i said would be way better and practical.

Assuming that the issue is modded leaves creates holes in the world, then such a system would not fix this. The entire issue is that MiEx assumes that the leaves are solid blocks by default, unless you tell it that it's not. And because MiEx thinks the leaves blocks are solid, they will occlude other blocks, thus creating the holes in the world that you see. The only actual fix is to tell MiEx that these blocks are leaves, which is done in the miex_config.json file. But this is why I indicated that for the next release of MiEx, I'll update the "Extract Mod Resource Pack" tool to create a miex_config.json for you.

So its not possible to have a cave removal feature that starts the removal few blocks later from foreground?

It's not really possible on a fundamental level, unfortunately, because MiEx cannot know where it should then add a face to get rid of the holes in the world without having to add in a tonne of unnecessary faces, unless you tell MiEx where it should add those faces, which you do with the miex_config.json file.

Most blocks are just cubes and have six faces. If you have two blocks next to each other, then you have two faces between the two blocks that you can't see. Because you can't see them, it would be very inefficient to still export and therefore try to render out those faces. So, MiEx (and Minecraft) gets rid of these faces between blocks. This is called occlusion culling in MiEx. However, in some cases you have blocks that are transparent (like leaves) and so you don't want to do this occlusion culling. If you still do the occlusion culling, then you get the result that you're seeing where you have holes in the world.

But how would MiEx know which blocks should occlude others and which shouldn't? This is why it needs to be specified in the miex_config.json file. If it just disables this occlusion culling close to the surface (which is what your idea would be doing), then it would just create whole bunch of unnecessary faces. The amount of faces would increase probably by over 10 times.

If you want to see what it could be like to have this occlusion culling turned off, you can enable the "Individual Blocks" checkbox in the top right of the window. Do make sure to only export a small section of your world, because it'll get really slow! This is what you'd then get: image Obviously it's all the way down, but even if it's limited to just the three closest blocks to the surface, you can still see that there would be a tonne of extra faces just slowing things down.

But again, for the next release of MiEx I'll try to automate generating the miex_config.json file so that you won't have to.

Thank you, that's what i wanted, an automation would be also perfect!

BramStout commented 1 month ago

The latest release of MiEx now has an updated Extract Resource Pack from Mod Pack tool which will automatically generate a miex_config.json file for you. It tries to infer the values based on the block states, block models, and textures. You might have to make a few small changes to the miex_config.json file for the few things that it got wrong, but it should mostly be right.

You can get the latest version here: https://github.com/BramStoutProductions/MiEx/releases/tag/v1.6.0