Simple geometry: to use materials or not?

Consider a scenario in which each object in a scene has only simple, very low-poly geometry (quads, etc.) and only a single (colour-)texture, all being rendered via the automatic shader-generator. In such a scenario, is it more rendering-efficient to have each object’s texture be applied via a material (set in the modelling program), or in code via “NodePath.setTexture”?

Part of my uncertainty is that each object would be modelled separately, and despite the materials differing only by the textures applied, I don’t know whether they would thus be treated as separate materials or unified in some way.

Similarly, I don’t know whether the auto-shaders are more efficient at rendering geometry with materials, or with none(/some Panda-provided default, if that’s how it works).

I’m thus in two minds as to whether to model these objects with materials, and apply my textures there, or to model them blank, and apply my textures in code.

(I doubt that it’s likely to be a major issue with such simple geometry, but it seems worth asking.)

It makes no difference. Do whatever is easiest for your workflow. If it’s easier for you to apply the textures via code, and you are worried about the extra number of nodes, you can flatten the scene after applying the textures.

Note that Blender’s “materials” don’t actually correspond to a single concept in Panda; as far as textures are concerned, it’s just as if setTexture were applied via code. A Panda3D “Material” object does not hold any textures, at least not in any current version of Panda3D. If you wish to specify textures via a material in Blender, but don’t wish to have setMaterial be called by the importer on any nodes, then you can disable these using a setMaterialOff call.

Ah, thank you for that–all of that is good to know, and encouraging. :slight_smile:

For this project, then, I’ll likely use Blender materials for the most part: it’s generally easier to make sure that the UVs are nicely-mapped when the textures are visible in Blender, after all.

As to “setMaterialOff”… Hmm… In fact, given what you say, I’m tempted to apply it to A Door to the Mists–I don’t actually use Panda materials in any way there, as far as I recall; everything is specified in other ways. It would be interesting to see whether it produces a performance boost of any sort, at least!