4
\$\begingroup\$

In Minecraft, there are some blocks which are a little bit different than just cubes.

For example stairs or fences: these elements are "aware" of their surrounding blocks and render differently based on if they are an edge, in the center, etc.

Other building games such as the Sims use a similar technique in the house building mode: the "voxels" are the same 1x1 metres but the mesh itself is usually thinner (like walls, side walls, etc.).

My question is:

  • What is the name of this technique?

Reference image

example

For the user perspective, there is only one "stairs" block. But when put next to each other, they behave differently.

\$\endgroup\$
3
  • \$\begingroup\$ Hello, and welcome to gamedv.SE! Please note that asking for external resources is off topic for this site. As such, I removed that part from your question. \$\endgroup\$
    – Vaillancourt
    Apr 27, 2018 at 6:53
  • \$\begingroup\$ Adding an example image or two could be a big help for users who don't know these games inside-out. \$\endgroup\$
    – DMGregory
    Apr 27, 2018 at 11:25
  • \$\begingroup\$ good idea! I'll a picture now \$\endgroup\$ Apr 28, 2018 at 2:06

2 Answers 2

3
\$\begingroup\$

It's either called Marching cubes/squares (depends on how many axes you're working with), autotile or -fence.

The marching algorithms work on filled areas. You define whether the corners of the squares or cubes are inside or outside of an object and it automatically generates the mesh for you. Marching squates needs 16, marching cubes needs 256 different tiles, but many of them are repeating.

Autotile is usually strictly 2d (or 3d if you do it only in a single plane, like minecraft) and also works on fileld areas, but this time the algorithm checks the 8 sorrounding tiles and chooses the appropariate texture based on those. You need 48 different tiles for this.

Autofence only checks the sorrounding 4 tiles and chooses the correct texture. Redstone in minecraft works like this and it's also great for fences and walls.

The stairs in minecraft are a little bit different, as they have actual directions and they act based on that, so that algorithm is probably custom.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks a lot, not sure if it's the same or not, so I fugure it's best to ask in a comment. In games like "little big planet", the user can simply draw a cuboid and select a "material", (say cardboard), and get this:static1.gamespot.com/uploads/original/1547/15470456/… (look at the rectangle below the characters). Is it a similar approach? is it marching cubes or squares? \$\endgroup\$ Apr 28, 2018 at 2:06
  • \$\begingroup\$ Another thing I was thinking for this particular case, could it be some sort of triplanar shader? \$\endgroup\$ Apr 28, 2018 at 2:25
  • \$\begingroup\$ @takada triplanar shaders don't have anything to do with meshes and yes, it's marching cubes \$\endgroup\$
    – Bálint
    Apr 28, 2018 at 8:13
2
\$\begingroup\$

I'm not aware of any special name for this technique. Nothing I can think of calling it is returning any meaningful results.

I do know that when the texture is different (not the block shape) based on the surrounding blocks it got called "connected textures" (due to the first time that a mod did that in Minecraft it was called Connected Textures).

Internally what Minecraft calls things like fences and walls having a different shape is just the block's "extended state" where extra data gets used to render the block model.

For some blocks its encoded in the "actual state" (where the non-adjective "state" is the Block+Metadata combination), which handles states based on information encoded in the world (such as neighboring blocks or TileEntity data). Fences and walls do this to indicate what sides they're connected on and that can be queried server-side by other code (e.g. other blocks).

While for other blocks, data encoded in the "extended sate," such as the exact height of each corner of a liquid block, is only used for rendering as it only affects the displayed graphical representation. This allows blocks like water and lava to have a steadily decreasing height slope rather than stair-step like (as snow layers does).

Context Aware Model, maybe?

\$\endgroup\$
2
  • \$\begingroup\$ Thanks a lot of your answer! So, do you think that internally in minecraft, these blocks have more than one mesh or is it only one that gets manipulated based on the state? \$\endgroup\$ Apr 27, 2018 at 4:59
  • \$\begingroup\$ @takadayoshiro Actual State values: separate meshes, which are loaded from disk, baked, and cached in ram. Extended State: Java code is executed each time the mesh is required to run-time-generate the required mesh, as there are too many combinations to cache. \$\endgroup\$ Apr 27, 2018 at 5:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .