focomoso Posted June 8, 2017 Share Posted June 8, 2017 I'm trying to import an .stl file with the asset manager. The task seems to complete successfully, but there are no meshes in the loadedMeshes array so there's nothing to add to the scene. The same thing happens if I use the SceneLoader.Load (and I've tested this using a local .stl file served off a local web server rather than aws with the same result). I suspect I'm just doing it wrong. playground here: http://www.babylonjs-playground.com/#V4WNE7#9 Thanks for any help. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 9, 2017 Share Posted June 9, 2017 Hello! I think this is because you are using a binary STL which is not supported by the loader focomoso 1 Quote Link to comment Share on other sites More sharing options...
focomoso Posted June 9, 2017 Author Share Posted June 9, 2017 Well, that would do it. I'll try an ascii (though it would be good if there were an error). If I were to write a binary stl importer, would it be better to integrate it into the existing stlFileLoader.js or create a binaryStlFileLoader.js? Quote Link to comment Share on other sites More sharing options...
focomoso Posted June 10, 2017 Author Share Posted June 10, 2017 Unfortunately there's a catch-22 here. The data being sent to the stlFileLoader has already been converted to a string (and lost significance) because loader itself has to register as .isBinary in order get useArrayBuffer to be true and therefore get binary data, but the choice of loader is based on file extension so there's no way for the loader to make the determination itself. The only workaround I can think of would be to have the stlFileLoader register as .isBinary and handle the conversion to a string itself (based on the content of the file). Does anyone think this might mess up other use cases? James Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 10, 2017 Share Posted June 10, 2017 This SHOULD work Quote Link to comment Share on other sites More sharing options...
focomoso Posted June 12, 2017 Author Share Posted June 12, 2017 Okay - I have this working. Except... When I export geometry from Blender for testing, the ascii output only seems to come in correctly if you use the setting Z forward Y up and the binary output only seems to work with Y forward and Z up. Are there any known issues with exporting stls from Blender (I'm no Blender expert)? Thanks for any help with this. James Quote Link to comment Share on other sites More sharing options...
focomoso Posted June 12, 2017 Author Share Posted June 12, 2017 I figured it out. Had to flip the order of the y and z vertices (and the normal). Below is the blender monkey exported from blender with Y up and -Z forward. The one on the left is binary, the one on the right, ASCII. Pull request created. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 13, 2017 Share Posted June 13, 2017 You rock! thanks a lot 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.