Question about BinaryImporter/Exporter

Hi all,

I've a question about the BinaryImporter / BinaryExporter. I've a 5MB .3ds model which should be converted in a Binary and then load in my scene. In JME 1.0 I used for this the JmeBinaryReader and it was realy very, very quik. The .jme file was loaded in 3 seconds. Now in JME 2.0 I use for save the model in Binary the BinaryExporter and for loading the BinaryImporter but it takes now 1 minute until the binary is loaded and then the scene also lacks.

Has anybody an idea why this is and how I can solve this problem? Or is it an generally problem with the BinrayImporter with "bigger" files? All small files, likes the bike.3ds works fine.


The resource locator might use some time too.

Can you check exactly where the time is used (locating the resource or reading the file)?

Without the ResourceLocator it takes the same time.

But I'm not sure if it's a problem with reading the file. The message in the console that the node is attached is shown immediatly but it takes so long until the model is shown in the scene.

Here's my code for loading the model:

public void loadModel(Node root, String path)
        String         modelBinary   = path.substring(0, path.lastIndexOf(".") + 1) + "jme";
        URL                        modelURL                 = null;
            try {
                modelURL = new URL("File:" + modelBinary);
            } catch (MalformedURLException ex) {
                Logger.getLogger(createModel.class.getName()).log(Level.SEVERE, null, ex);
        String                  name            = path.substring(path.lastIndexOf("\")+1, path.lastIndexOf("."));

        ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, new SimpleResourceLocator(new File(path).getParentFile().toURI()));

        try {
                //load the jme format
                model = (Node) BinaryImporter.getInstance().load(modelURL.openStream());
        } catch (IOException e) {

        model.setLocalTranslation(new Vector3f(0,10,0));
        model.setModelBound(new BoundingBox());


Well,…5MB of vertex-data might be quite a lot of vertices/faces. What is your modeller saying about that values?

I optimized the BinaryImporter/Exporter classes in jME3. One of the biggest bottlenecks was reading the index buffer, since the indices were not stored as-is but compressed a bit, this is a huge performance eater on large index buffers.

Perhaps you can try running a profiler and see where the bottleneck is.

ok, then I try it with setting up JME3, hope this will help.

But how could it be that functions in older versions runs greater and faster as in new solutions?

So, now I where the problem is.

I attached the model to a node with Shadows. If I attach the model to an other node it is loaded so fast as in the past.

But now there is an other problem, I need the Shadows. Is there a possibility to attach a model with so many vertices to a shadow node without this lacks?

Aha… Okay, so that's where the problem is.

The issue is in the shadow volume generation, I am not sure, but I think it is possible to export the shadow volume using the BinaryImporter/Exporter, so you don't have to generate it every time.

The shadow volume is most likely set using setUserData() call, check where that happens to gain an insight on how to generate the shadow volume offline, then you won't have such long loading times.

That's a good idea with the export/import. I will try it.