Export blender 3d model and convert it in .bam or .egg

I made it ! the command : python -m blend2bam background.blend --blender-dir “C:\Program Files\Blender_Foundation\Blender” background.bam" worked !

But the model has no texture even if the blender file had one … ? do you know how to add one ? Because i tried a code :
"
background = self.loader.loadModel(“mymodels/background.bam”)
tex = self.loader.loadTexture((“mymodels/tex/planks.jpg”))
background.setTexture(tex)
background.reparentTo(self.render)
background.setPos(0, 10, 0)
"
but the 3d model still doesn’t have textures :confused:

I’m afraid that I don’t use blend2bam myself, and so am not in much of a position to help. :/

As to the texture-assignment code, if the model already has a texture entry (whether that entry is visible or not) then setting a texture over the model may be a little more tricky than just that.

This manual page may prove helpful:
https://docs.panda3d.org/1.10/python/programming/texturing/simple-texture-replacement.html

Thanks a lot for all the help you provided me ! I’ll check the link and maybe i will be able to start creating my game !

1 Like