Improving the "cullface" feature in block models to make it more powerful
"Cullface" Could Be Improved
For the non technical among the readers culling faces is where a model does not render a face of a cube, usually because it can't be seen (it's mainly intended to improve performance by hiding unseen faces). However you can also use it for texture pack making. The only predicate currently available is whether there is a block in adjacent direction. e.g. if I had "cullface": "up" on a face in a block model, it would hide the face if there was a block above it. This could be extended through the use of some slightly different predicates:
Inverse Culling (a.k.a. NOT):
This would allow you to show a face if an adjacent block exists. A simple way to do this would be "cullface": "!<direction>", placing a exclamation mark at the start of the string, as they are often used in coding to show negation, including in Minecraft commands such as the @e type selector. A basic example of a thing you could use this for is something like making cobweb work like vines without needing blockstates.
Sum Culling (a.k.a. OR):
This might be slightly harder to implement, as my suggestion involves making the "cullface" key take an array rather than a string. Written as "cullface": ["<direction_1>", "<direction_2>", etc.], this would cull the face if there is a block in at least one of the directions. The main thing this would be useful for is implementing a simple form of connected textures in vanilla. The directions in the array could also be the inverse ones from above.
Please sign in to leave a comment.