Skip to content
Fx Morin edited this page Jan 20, 2024 · 4 revisions

Custom Culling Shapes

MoreCulling allows resource packs to contain culling shape data, allowing for much better culling of custom models.

Why is this important?
Minecraft has all the culling shapes hard coded internally, which is fine. Although lots of other resource packs add 3D block models or custom models, which do not respect the culling shape correctly. Resulting in xray blocks when the models don't match the culling shapes.

All you need to do is add a "cullshapes": [] section to your models with the model boxes and your good to go. E.x.

{
  "textures": {
    "particle": "block/something",
    "all": "block/something",
  },
  "elements": [
    {
      "from": [ 2, 13, 7 ],
      "to": [ 14, 15, 9 ],
      "faces": {
        "north": { "uv": [ 2, 2, 14, 4 ], "texture": "#all" },
        "south": { "uv": [ 2, 3, 14, 5 ], "texture": "#all" },
        "up":    { "uv": [ 2, 3, 14, 5 ], "texture": "#all", "cullface": "up" },
        "down":  { "uv": [ 2, 3, 14, 5 ], "texture": "#all", "cullface": "down" }
      }
    },
    {
      "from": [ 14, 0, 6 ],
      "to": [ 16, 16, 10 ],
      "faces": {
        "north": { "uv": [ 0, 1, 2, 16 ], "texture": "#all", "cullface": "north" },
        "east":  { "uv": [ 0, 1, 4, 16 ], "texture": "#all", "cullface": "east" },
        "south": { "uv": [ 0, 1, 2, 16 ], "texture": "#all", "cullface": "south" },
        "west":  { "uv": [ 0, 1, 4, 16 ], "texture": "#all", "cullface": "west" },
        "up":    { "uv": [ 0, 0, 2,  4 ], "texture": "#all", "cullface": "up" },
        "down":  { "uv": [ 0, 0, 2,  4 ], "texture": "#all", "cullface": "down" }
      }
    },
    {
      "from": [ 0, 0, 6 ],
      "to": [ 2, 16, 10 ],
      "faces": {
        "north": { "uv": [ 0, 1, 2, 16 ], "texture": "#all", "cullface": "north" },
        "east":  { "uv": [ 0, 1, 4, 16 ], "texture": "#all", "cullface": "east" },
        "south": { "uv": [ 0, 1, 2, 16 ], "texture": "#all", "cullface": "south" },
        "west":  { "uv": [ 0, 1, 4, 16 ], "texture": "#all", "cullface": "west" },
        "up":    { "uv": [ 0, 0, 2,  4 ], "texture": "#all", "cullface": "up" },
        "down":  { "uv": [ 0, 0, 2,  4 ], "texture": "#all", "cullface": "down" }
      }
    }
  ],
  "cullshapes": [
    {
      "from": [ 14, 0, 6 ],
      "to": [ 16, 16, 10 ]
    },
    {
      "from": [ 0, 0, 6 ],
      "to": [ 2, 16, 10 ]
    }
  ]
}

Using Model Shapes

Sometimes you may have a complicated model, and you don't want to have to copy over all the positions from the model data. you can use the useModelShape json boolean argument to automatically do it for you. Let me show you!

{
    "parent": "block/block",
    "textures": {
        "particle": "block/something",
        "all": "block/something"
    },
    "elements": [
        {   
            "from": [ 6, 15, 6 ],
            "to": [ 10, 16, 10 ],
            "faces": { "down": { "uv": [ 6,  6, 10, 10 ], "texture": "#all" } }
        },
        {
            "from": [ 5, 14, 5 ],
            "to": [ 11, 15, 11 ],
            "faces": { "up": { "uv": [ 5,  5, 11, 11 ], "texture": "#all" } }
        },
        {
            "from": [ 5, 13, 5 ],
            "to": [ 11, 14, 11 ],
            "faces": { "north": { "uv": [ 4, 13, 12, 14 ], "texture": "#all" } }
        },
        {
            "from": [ 3, 11, 3 ],
            "to": [ 13, 13, 13 ],
            "faces": { "south": { "uv": [ 3, 11, 13, 13 ], "texture": "#all" } }
        },
        {
            "from": [ 2, 8, 2 ],
            "to": [ 14, 11, 14 ],
            "faces": { "west": { "uv": [ 2, 8, 14, 11 ], "texture": "#all" } }
        },
        {
            "from": [ 1, 3, 1 ],
            "to": [ 15, 8, 15 ],
            "faces": { "east": { "uv": [ 1, 3, 15,  8 ], "texture": "#all" } }
        }
    ],
    "cullshapes": [
        {
            "from": [ 6, 15, 6 ],
            "to": [ 10, 16, 10 ]
        },
        {
            "from": [ 5, 14, 5 ],
            "to": [ 11, 15, 11 ]
        },
        {
            "from": [ 5, 13, 5 ],
            "to": [ 11, 14, 11 ]
        },
        {
            "from": [ 3, 11, 3 ],
            "to": [ 13, 13, 13 ]
        },
        {
            "from": [ 2, 8, 2 ],
            "to": [ 14, 11, 14 ]
        },
        {
            "from": [ 1, 3, 1 ],
            "to": [ 15, 8, 15 ]
        }
    ]
}

The entire cullshape block can be replaced by:

"useModelShape": true

So your json would look like:

{
    "parent": "block/block",
    "textures": {
        "particle": "block/something",
        "all": "block/something"
    },
    "elements": [
        {   
            "from": [ 6, 15, 6 ],
            "to": [ 10, 16, 10 ],
            "faces": { "down": { "uv": [ 6,  6, 10, 10 ], "texture": "#all" } }
        },
        {
            "from": [ 5, 14, 5 ],
            "to": [ 11, 15, 11 ],
            "faces": { "up": { "uv": [ 5,  5, 11, 11 ], "texture": "#all" } }
        },
        {
            "from": [ 5, 13, 5 ],
            "to": [ 11, 14, 11 ],
            "faces": { "north": { "uv": [ 4, 13, 12, 14 ], "texture": "#all" } }
        },
        {
            "from": [ 3, 11, 3 ],
            "to": [ 13, 13, 13 ],
            "faces": { "south": { "uv": [ 3, 11, 13, 13 ], "texture": "#all" } }
        },
        {
            "from": [ 2, 8, 2 ],
            "to": [ 14, 11, 14 ],
            "faces": { "west": { "uv": [ 2, 8, 14, 11 ], "texture": "#all" } }
        },
        {
            "from": [ 1, 3, 1 ],
            "to": [ 15, 8, 15 ],
            "faces": { "east": { "uv": [ 1, 3, 15,  8 ], "texture": "#all" } }
        }
    ],
    "useModelShape": true
}
Clone this wiki locally