Is it possible to use multiple materials per model?

Is it possible to use multiple materials (with or without multiple meshes) per model? If so, how? The documentation on this is very out-of-date and misleading, since a lot of the information is now wrong.

Yes, additional material slots are shown when you use a gltf with multiple materials/meshes. We will make sure to review the docs and update them beginning of next week.

Yes I see the slots show up but they don’t always work, and it seems that they never work in the editor, only at runtime, so I’m wondering what the limitations and requirements are. I’d rather not have to figure it all out by trial and error.

1 Like

Got it. We’ll have to wait until after the weekend and let @jhonny.goransson answer.

The new (modern) pipeline materials work much better with the editor now. I tested it using many models and textures, and the results are significantly better than with the legacy pipeline. Unfortunately, the built-in materials still use the legacy pipeline, but updating the model material is very easy.

In my experience, they work pretty nicely (using the new pipeline).
It’s hard to comment on your issue since you haven’t described the actual problem.
Are you sure you don’t have a UV or model problem?"

It would be good to have examples demonstrating the fundamentals of this; the more the merrier:-)

Multi-material GLB model Renders with Incorrect Textures · Issue #9074 · defold/defold · GitHub I see the main issue I’m facing has already been reported, but there’s no diagnosis yet.

Okay, I’ll give that a try. :+1:

If that is the issue you are having, then the new pipeline won’t change much I’m afraid. It needs a fix from the instancing branch (which I wrote in the comments) before we can resolve the issue.

1 Like

Okay, thanks! Do you have any idea what causes that, because it doesn’t always seem to happen. I tried a simple example and it displays fine at runtime:
This is a model with three cube meshes, each with a different material set. The right one uses different fragment shaders that output different colors, but the left one is the built-in model material with different textures.

I saw this thread and this bug report, but they seem to describe a different issue—I’m not getting a crash and my models do render (but only using the first texture), but maybe it’s related?

1 Like

Yes, I deliberately never said that I had a problem in the opening post. I only asked if it was possible and how to do it, because nowhere in the docs is it stated that this is supported at all (quite the opposite in the case of multiple meshes per model). Issue reports seem to inevitably devolve into fault-finding with the report and the person who made it. :frowning:

1 Like