Use same model for few nodes

I am quite a newbye in Panda, so coul you please tell me if it’s possible to use the same 3D model (geometry and texture) in multiple nodes. I mean not loading the same file but to share already loaded model.
Thank you!

The answer depends on what your goal is.

  1. If you want to reduce load time, this is not an issue.
    Loading a model keeps it cached in memory, so if you try to load it again it is just making a copy in memory and is very fast.
# first one reads from hard drive
first_model = loader.loadModel("my_model_file")
# second one reads from memory
second_model = loader.loadModel("my_model_file")
  1. If you want to update many of the same model by just changing one of them, then you can use Python’s copy module. This results in a sort of weak copy where you can manipulate one model and have the rest mirror the first one.
first_model = loader.loadModel("my_model_file")
import copy
second_model = copy.copy(first_model)
  1. If you want to improve frame rate, Panda does have hardware instancing, but it is not well documented and a bit difficult to use.

If I recall correctly, you can also use a form of NodePath instancing to improve animation-related performance; see this manual entry for more.

Great! Thanks a lot for the help, guys!
I’ve also found an implementation of hw instancing in the recent bolog posts: