Nesh108 Posted April 6, 2017 Share Posted April 6, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 6, 2017 Share Posted April 6, 2017 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 Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted April 7, 2017 Author Share Posted April 7, 2017 Ahah, of course not. I imported the obj into Blender and exported it using the Babylon exporter plugin. Unless I did something wrong Let me check with the debug layer Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted April 7, 2017 Author Share Posted April 7, 2017 Ok, I checked and none of the babylon meshes have any vertex loaded. What's wrong? :/ Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 7, 2017 Share Posted April 7, 2017 Tough to say without further analysis. Is the mesh display correctly in blender? Can you share the .blend file? (ping our Blender divinity @gryff) Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 7, 2017 Share Posted April 7, 2017 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. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted April 9, 2017 Share Posted April 9, 2017 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 Nesh108, GameMonetize and Wingnut 3 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 9, 2017 Share Posted April 9, 2017 @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. gryff 1 Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted April 10, 2017 Author Share Posted April 10, 2017 I see! I will retry and let you know @Deltakosh@Wingnut@gryff Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 10, 2017 Share Posted April 10, 2017 take care @gryff Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.