3 3d models
whosit edited this page 2024-11-22 17:01:23 +00:00

Using multiple textures for wavefront .obj format

If mesh needs to use multiple textues, as can be specified by:

visual = "mesh",
mesh = "model.obj".
textures = { "texture1.png", "texture2.png" ...}

then .obj file must have polygon groups defined by the g tag (usemtl is ignored by minetest). It's described here (don't know if there's better documentation?).

What this means, if inside .obj file (it's just plaintext, open with your text editor) you have usemtl tags, then you can just add g <group_name> line before each usemtl line and textures will be assigned in oder of definition (group names and material names don't matter).

Working file should look like this:


...

g First_material
usemtl Material.000
s off
f 4/1/1 3/2/1 7/3/1 8/4/1
f 8/5/2 7/6/2 5/7/2 6/8/2
f 6/9/3 2/10/3 4/1/3 8/11/3
f 2/10/4 1/12/4 3/2/4 4/1/4
f 6/8/5 5/7/5 1/12/5 2/10/5
g Second_material
usemtl Material.001
f 1/12/6 5/13/6 7/14/6 3/2/6

...

Then First_material group will be assigned "texture1.png" etc.

  • NOTE: In blender, you can toggle this option:

obj export options

to make those groups for you automatically. (just import your .obj file and export it again with this box checked).