Patreon

Configuring Meshes

The new custom meshes feature added to mv3d and mz3d is a little confusing, so I’m writing a quick explanation of how to use the new feature.

On the surface the mesh function and the model function may seem very similar, and they do have very similar results.

The mesh function takes a set of instructions and uses it to construct a mesh for the tile or event. The model function is still the easiest way to import complex 3D models. The mesh function is more meant for constructing simple models and, since it’s plain text, making them easier to share.

Each mesh is composed of multiple parts. At this point in time, there are three types of parts. Cuboids, quads, and point data. Each type is identified by the first letter in its name: c, q, and p respectively. There is also a special type, qq, the double-sided quad, which is a variant of the quad type.

The parameters for each part is placed within { } brackets. Each type of part takes its own set of parameters.

The parameters for quads are xsize,ysize|xoff,yoff,zoff|yaw,pitch,roll|{texture}

Where texture is a set of texture parameters, configured the same way as other textures (see the textures section of the documentation)
All of the texture’s parameters should be contained in nested { } brackets
◇Examples
mesh(q{1,1|0,0,0|0,0,0|{B,1,19}})
mesh(q{2,2|||{B,1,19}}q{1.5,1.5|,,.5||{B,1,19}}q{1,1|,,1||{B,1,19}})

The parameters for cuboids are xsize,ysize,zsize|xoff,yoff,zoff|yaw,pitch,roll|{top},{bottom},{south},{east},{north},{west}

Each side (top,bottom,south,east,north,west) is a texture, and should be configured the same way as the quad’s texture. Sides without a configured texture will use the last texture in the list.
◇Examples
mesh(c{1,1,1|0,0,0|0,0,0|{A1,0,0},{0},{A1,5,0}})
mesh(c{|||{A1,0,0},{0},{A1,5,0}}c{|,,1|45|{A1,0,0},{0},{A1,5,0}})

The parameters for point data are positions…|indices…|uvs…|{texture}

The positions, indices, and uvs, are each of list of numbers containing the relevant data. If the indices or uvs are omitted, the plugin will attempt to generate them automatically. This usually only works well for meshes with very few points (such as a single triangle).
◇Examples
mesh(p{0,0,0, 0,-1,.5, .866,.5,.5, -.866,.5,.5, 0,0,1|0,1,2, 0,3,1, 0,2,3, 4,3,2, 4,2,1, 4,1,3|.5,.5, .5,0, .75,.75, .25,.75, .5,.5|{A5,6,8}})
mesh(p{-.5,-.5,1, .5,-.5,0, -.5,.5,0|||{A2,0,0}})

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments