Multiple textures - multiple model areas

In the manual there is a good example how to simply replace the texture of a model, and there is also the car example where the color of the body is changed from red to blue without affecting the tires.

The manual example needs you to have the model consist of different geoms, so you can ‘.find()’ the different parts.
All good but if i have a plain geom that has 4 verts and 2 tris, i can map a different texture to both tris in blender,i dont even have to use any materials, i can export it and it shows just fine in pview and panda3d. Now how do i change only one of the textures without affecting the other in panda3d during runtime?

And if i have a more complex object that has multiple uv’s and multiple textures mapped to different parts and consist of one geom/mesh(can also be done in blender without materials and it shows fine in panda3d).

Thanx in advance.

Although it is possible to find these different pieces in Panda and change their textures at runtime, it’s complicated and difficult to do so, unless you make them separate meshes, each with its own name. That’s why you have separate meshes, after all: so you can control each mesh independently. Otherwise your entire scene would be one big mesh.

(For the record, what appears to be a single mesh actually gets exported as multiple different Geoms in Panda if it involves multiple textures. This is because your hardware is not capable of applying different textures to different parts of a single mesh, so we have to separate it out at conversion time. You can find these different Geoms by walking through the Geoms of a GeomNode, but there’s no guarantee of ordering, so it will be difficult to tell which part is which. You could examine the texture that’s already on it and make conclusions based on that, but come on, you’re just being stubborn now.)

Short answer: split out the meshes in blender and give each one its own name, so you can reliably find it in Panda.


heyho. about that blender thing. i experimented with it some time ago. i found the following if i remember correctly: having one conintous object in blender (as one mesh object with one continous surface) i can only use a limited number of textures. the rest will turn up white. it gets exported and loaded as one geom (according to analyze()).

having one meshobject in blender. but having several non-connected surfaces in that, with only one texture assigned to each surface. allowed me a lot more textures (havent foudn a limit). and it still loaded as one geom.

having multiple meshobjects in blender with one texture each worked just aswell but resulted in multiple geoms. which brought down performance in my tests (with a few thousand cubes)

just what i remember from my test. no garantuee it works but maybe try for yourself.

I first used different mesh obj in blender and exported them as one egg/bam. Worked great.

Then i red somewhere that geom this geom that, the less the better, so i joined all my mesh obj into a single continuous obj. Worked great but the vert count got up due to joining in places not needed.

Then i decided to do one mesh obj with non continous meshes. Also great

But from the modelling perspective, separate obj are the best and easiest to do in blender.

Never really checked the geom count or any performance.

Never the less big thank yous to David and Thomas, cleared up some things in my head.

Ill never join meshes again as in my case it was 1 mesh vs 4 meshes. And i think thats not the place to worry about geom count.