Jump to content

Cannot load mesh after having it converted into .babylon


Nesh108
 Share

Recommended Posts

Hello!

I have been trying to load some OBJ files with Babylon. After a few attempts, I managed to get it up and running:

 

        BABYLON.OBJFileLoader.OPTIMIZE_WITH_UV = true;
        let loader = new BABYLON.AssetsManager(this.scene);
        loader.useDefaultLoadingScreen = false;
        
        let player_task = loader.addMeshTask('player_mesh', '', MESH_PATH, 'player.obj');

        player_task.onSuccess = function (task) {
                    // Meshes
                    task.loadedMeshes.forEach(function(m) {
                        m.position = BABYLON.Vector3.Zero();
                        m.scaling.x = 0.13;
                        m.scaling.y = 0.13;
                        m.scaling.z = 0.13;

                        this.set_player_mesh(m);
                    }.bind(this));
            }.bind(this);

        }

        loader.onFinish = function() {
            this.babylon_engine.runRenderLoop(function () {
                this.scene.render();
            }.bind(this));
        }.bind(this);

        loader.load();

I had to create an empty 'player.obj.manifest', otherwise it would complain, and everything worked. All good here but when I try to load the same exact OBJ but converted into a .babylon file (I am doing this just because I need to import some animations), the mesh seems to be loaded but nothing gets displayed.

I removed the 'BABYLON.OBJFileLoader.OPTIMIZE_WITH_UV = true;' as it would not be needed and changed the filename to 'player.babylon. I tried testing it out on some playgrounds but still nothing.

Are there other changes needed? Also, is there a way to just simply load an OBJ with animations without having to convert it to a babylon file? That would definitely save me tons of time...

I have attached here the mesh I am using.

Goku.babylon

Link to comment
Share on other sites

Hello

here is some doc about the manifest: http://doc.babylonjs.com/tutorials/caching_resources_in_indexeddb

Regarding the obj, you cannot renamed it to .babylon as it is not a babylon file :)

Can you run scene.debugLayer.show() to display the inspector? It will help you figure out if there is a camera and a light for instance

Link to comment
Share on other sites

Hi guys.  PG version:  http://www.babylonjs-playground.com/#10MM3T#3

Doesn't work, but SOMETHING is inside scene.meshes.  .getTotalVertices() returns 0, as mentioned earlier. 

No .material on mesh, either.  Adding one changed nothing.

Old exporter version?  *shrug*  I'll keep thinking.

Deltakosh:  "divinity"  :)  Cool use of that word.

Link to comment
Share on other sites

Sorry for the slow response - I've been confined to bed fighting a major health issue for over a week :(

I took a look at both the .babylon file that @Wingnut used and the one that @Nesh108 posted above - both seem to have been produced with an old version of the Blender Babylon Exporter :(

The current up-to-date exporter will produce something like this as a first line:

{"producer":{"name":"Blender","version":"2.76 (sub 0)","exporter_version":"5.2.0","file":"filename.babylon"},

The "Goku" files that I looked at do not have this line. However, they do have "light" and "camera" arrays right at the top of the file - which with the latest version of the BBE are now found at the end of the file.

The files also have a large "vertex" array - so I have no idea why @Wingnut's test produces 0 for total verts.

First suggestion - update the Exporter and try re-exporting the mesh.

If that fails, please can you post  your .blend file @Nesh108 , so I can look for other  file issues

@Deltakosh and @Wingnut: the words of Erasmus about the "one-eyed man" spring to mind.

cheers, gryff :)

 

Link to comment
Share on other sites

@gryff - GET WELL SOON!  Sorry to hear you are sick. 

I "liked" everything else you said in that post, though.  :)

Yeah, I think the mesh did a parse-flop.  Deserialization explosion.  SceneLoader said "yech, this beer is stale"  :)

And I happen to KNOW that you have AT LEAST 7 eyes... although a few of them could be dozing. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...