So Minecraft uses procedural meshes, how do they address a specific block? How can they separate a stone block from a dirt block?
Minecraft is just an example. I want to now how it works technically.
So Minecraft uses procedural meshes, how do they address a specific block? How can they separate a stone block from a dirt block?
Minecraft is just an example. I want to now how it works technically.
If you are talking about the block models, as in how the textures are layered over them, Minecraft uses a .json
file as a model as of the newest Minecraft version, 1.8. An example of the .json
file is as follows:
{
"ambientocclusion": false,
"textures": {
"particle": "blocks/glass",
"glass": "blocks/glass",
"obsidian": "blocks/obsidian",
"beacon": "blocks/beacon"
},
"elements": [
{ "__comment": "Glass shell",
"from": [ 0, 0, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" },
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#glass" }
}
},
{ "__comment": "Obsidian base",
"from": [ 2, 0.1, 2 ],
"to": [ 14, 3, 14 ],
"faces": {
"down": { "uv": [ 2, 2, 14, 14 ], "texture": "#obsidian" },
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#obsidian" },
"north": { "uv": [ 2, 13, 14, 16 ], "texture": "#obsidian" },
"south": { "uv": [ 2, 13, 14, 16 ], "texture": "#obsidian" },
"west": { "uv": [ 2, 13, 14, 16 ], "texture": "#obsidian" },
"east": { "uv": [ 2, 13, 14, 16 ], "texture": "#obsidian" }
}
},
{ "__comment": "Inner beacon texture",
"from": [ 3, 3, 3 ],
"to": [ 13, 14, 13 ],
"faces": {
"down": { "uv": [ 3, 3, 13, 13 ], "texture": "#beacon" },
"up": { "uv": [ 3, 3, 13, 13 ], "texture": "#beacon" },
"north": { "uv": [ 3, 2, 13, 13 ], "texture": "#beacon" },
"south": { "uv": [ 3, 2, 13, 13 ], "texture": "#beacon" },
"west": { "uv": [ 3, 2, 13, 13 ], "texture": "#beacon" },
"east": { "uv": [ 3, 2, 13, 13 ], "texture": "#beacon" }
}
}
]
}
All blocks models are made in files like this that can be modified by the player. The game then goes in and reads them, creating the models from the .json
data. There are several 3rd party programs that assist in making of these files.
If you are interested in seeing how the .json
file is read, a great program for decompiling Minecraft is the Minecraft Coder Pack, another 3rd party program.
Well, if you want to see how Minecraft distinguishes a stone block, from a dirt block, for example, they do it like so:
.json
files for configuring how the block looks, which look like so:{
"parent": "block/cube_all",
"textures": {
"all": "blocks/dirt"
}
}
Minecraft also has blockstate
.json
files, which are used to define variants of a block, for example, a saplings growth states.