OSError: Could not load model file(s)


#1

Hello,

I’m just starting with panda3d. I’ve gone through the tutorials. Now I have tried to use my own .egg file in place of the pre-packaged .egg files used in the tutorial.

All I’ve done is run blender and created an .egg with the default blender cube, with a color texture applied (tried even without texture, although I don’t know what this would do to change). I export this to .egg into the panda3d/models directory where the other (tutorial) models are located.

I replace the tutorial model name with the name of my .egg file (without the extension) and I get this error:

raise IOError(message)
OSError: Could not load model file(s)

Is there a good place here for guidance on loading your own .egg files other than the tutorial? I’ve looked at the YABEE documentation but I don’t know what I’m doing wrong. Thanks.


#2

Here is my code fwiw:

from direct.showbase.ShowBase import ShowBase

class MyApp(ShowBase):

    def __init__(self):
        ShowBase.__init__(self)
        self.scene = self.loader.loadModel("models/environment")
        self.scene.reparentTo(self.render)
        self.scene.setScale(0.25, 0.25, 0.25)
        self.scene.setPos(-8, 42, 0)
        self.box = self.loader.loadModel("models/test")
        self.box.reparentTo(self.render)
        self.box.setPos(0, 0, 3)
        self.box.setScale(0.5, 0.5, 0.5)
        
app = MyApp()
app.run()

#3

Please note that you should have a “models” folder next to the script.

main.py
models
    test.egg
    environment.egg

If you want a bootloader model from the Panda3d catalog, do not specify a directory, for example “box”


#4

I am slightly mystified as to why it doesn’t work as in the original script–as noted there, the Panda-provided models seem to work from that directory–but otherwise I recommend as @serega-kkz does: if you place your models in a directory within your project’s main directory, and then use relative paths to access them, it should work.

(It can be made to work via absolute paths, or directories outside of your project directory, but that may well lead to trouble later.)


#5

Need to check the Config.prc file
For lines:
model-path $MAIN_DIR
model-path $THIS_PRC_DIR/…
model-path $THIS_PRC_DIR/…/models


#6

Hello and thank you,

My config.prc file is properly configured with the model path. I have also used the fully qualified path to be sure and it still does not work.

I believe the error lies somewhere in the Blender conversion and is making the .egg not readable by Panda3d. Since I’m so new at panda I’m not sure how to configure a blender obj to be convertable to .egg.

Error in /c/Panda3D-1.10.0-x64/models/test.egg at line 183, column 18:
      <TRef> { Tex }
                 ^
Unknown texture Tex

:egg2pg(error): Error reading /c/Panda3D-1.10.0-x64/models/test.egg
:loader(error): Couldn't load file /c/Panda3D-1.10.0-x64/models/test.egg: invalid.
Traceback (most recent call last):
  File "hellowa.py", line 60, in <module>
    app = MyApp()
  File "hellowa.py", line 22, in __init__
    self.box = self.loader.loadModel("/c/Panda3D-1.10.0-x64/models/test.egg")
  File "C:\Panda3D-1.10.0-x64\direct\showbase\Loader.py", line 248, in loadModel
    raise IOError(message)
OSError: Could not load model file(s): ['/c/Panda3D-1.10.0-x64/models/test.egg']

I have tried without the .egg. I also noticed that I cannot open the .egg file directly, again making me think I’ve done something incompatible. I’ve looked through the YABEE doc and don’t know what it could be.


#7

This is actually an egg error. This is not related to the search for a model.


#8

Thank you for responding,

Is there any place other than the YABEE doc that shows proper method of converting a blender obj to a usable .egg? I tried to open the egg file directly and it will not open:

Error in /c/Panda3D-1.10.0-x64/models/test2.egg at line 183, column 18:
      <TRef> { Tex }
                 ^
Unknown texture Tex

:egg2pg(error): Error reading /c/Panda3D-1.10.0-x64/models/test2.egg
:loader(error): Couldn't load file /c/Panda3D-1.10.0-x64/models/test2.egg: invalid.
  Texture Object                  .txo
  DirectDraw Surface              .dds
  Khronos Texture                 .ktx
  SGI RGB                         .rgb, .rgba, .sgi
  Targa                           .tga
  Raw binary RGB                  .img
  SoftImage                       .pic, .soft
  Windows BMP                     .bmp
  NetPBM-style PBM/PGM/PPM/PNM    .pbm, .pgm, .ppm, .pnm
  Portable Float Map              .pfm
  JPEG                            .jpg, .jpeg
  PNG                             .png
  TIFF                            .tiff, .tif
  OpenEXR                         .exr
  stb_image                       .psd, .hdr, .gif
  MovieTexture                    .asf
  MovieTexture                    .avi
  MovieTexture                    .flv
  MovieTexture                    .m2v
  MovieTexture                    .mkv
  MovieTexture                    .mov
  MovieTexture                    .mp4
  MovieTexture                    .mpeg
  MovieTexture                    .mpg
  MovieTexture                    .nut
  MovieTexture                    .ogm
  MovieTexture                    .ogv
  MovieTexture                    .webm
  MovieTexture                    .wmv
Unable to load /c/Panda3D-1.10.0-x64/models/test2.egg
:framework(warning): Empty bounding volume for models

Maybe there is something really simple I’m missing. I tried also to convert some blender models I have previously made and they also will not open. I have tried blender 2.79 and 2.78 (different machines) and have the latest YABEE. Thanks again for trying to help.


#9

Post your file on the forum. Also pay attention to the presence of the texture.


#10

untitled.zip (6.6 KB)
Try to download, just place the next to the script
file: untitled.egg
folder: tex


#11

This worked! How do I specify the texture on export? Thank you again.


#12
  1. Create UV texture coordinates.
  2. Create material.
  3. Link the texture through the slot “Image or Move”

Can be exported.