cxiao1 Posted September 7, 2016 Share Posted September 7, 2016 Hello, I purchased a 3d scene in the file format of obj, as well as some texture files. The obj file has 187 MB. I tried using the following code to load the obj file (I tested my code with other obj sample files, works ok). However, after a while of loading, my webpage crashes afterwards. I uploaded the screenshot of the webpage after it crashes. I use babylon.2.4.js, babylon.objFileLoader.js, node.js for my web service and IIS for the server. I was wondering can anyone help me with this issue? Thank you so much!!! Yours Sincerely, Chi Xiao var camera, scene; window.addEventListener('DOMContentLoaded', function() { var canvas = document.getElementById('renderCanvas'); var engine = new BABYLON.Engine(canvas, true); engine.enableOfflineSupport = false; BABYLON.SceneLoader.Load("http://127.0.0.1:8082/scenes/kc8/", "kc8.obj", engine, function (newScene) { camera = new BABYLON.ArcRotateCamera("Camera", 3 * Math.PI / 2, Math.PI / 8, 50, BABYLON.Vector3.Zero(), newScene); camera.attachControl(canvas, true); var light = new BABYLON.HemisphericLight("hemi", new BABYLON.Vector3(0, 1, 0), newScene); light.diffuse = new BABYLON.Color3(1, 1, 1); light.specular = new BABYLON.Color3(1, 1, 1); light.groundColor = new BABYLON.Color3(0, 0, 0); engine.runRenderLoop(function() { newScene.render(); }); window.addEventListener('resize', function() { engine.resize(); }); }); }); Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 8, 2016 Share Posted September 8, 2016 This "should" work Do you mind publishing it somewhere so we can debug it? Quote Link to comment Share on other sites More sharing options...
cxiao1 Posted September 8, 2016 Author Share Posted September 8, 2016 @Deltakosh Thank you so much for your reply Do you mean publishing the obj file? Quote Link to comment Share on other sites More sharing options...
max123 Posted September 8, 2016 Share Posted September 8, 2016 187mb? How many vertices? Quote Link to comment Share on other sites More sharing options...
cxiao1 Posted September 8, 2016 Author Share Posted September 8, 2016 @max123 AnimatedNo RiggedNo VR / AR / Low-polyYes GeometryPolygon mesh Polygons1,252,371 Vertices1,600,638 TexturesYes MaterialsYes UV MappingYes Unwrapped UVsMixed Plugins usedNo Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 8, 2016 Share Posted September 8, 2016 One thing you might do is to set the logging level before starting. This will give you a status of each mesh / material / light / camera that got loaded BABYLON.SceneLoader.loggingLevel = BABYLON.SceneLoader.DETAILED_LOGGING; Unless this is just a single mesh . Quote Link to comment Share on other sites More sharing options...
cxiao1 Posted September 8, 2016 Author Share Posted September 8, 2016 @JCPalmer I added it in my code and run my html again. Got the same crash, but don't see any logs. Where are the logs displayed? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 8, 2016 Share Posted September 8, 2016 Should be the console. I guess this is only for the .babylon loader, though I implemented the info in .toString() methods of the created objects. This should enable the obj or glTF to add without doing too much. Worth a try. I know nothing about OBJ, so I'm out, sorry. Quote Link to comment Share on other sites More sharing options...
max123 Posted September 8, 2016 Share Posted September 8, 2016 1 hour ago, cxiao1 said: @max123 AnimatedNo RiggedNo VR / AR / Low-polyYes GeometryPolygon mesh Polygons1,252,371 Vertices1,600,638 TexturesYes MaterialsYes UV MappingYes Unwrapped UVsMixed Plugins usedNo 1.6 mil vertices could be a problem: WebGL uses unsigned shorts and bytes for indices, according to this. Which gives you around 65k vertices. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 8, 2016 Share Posted September 8, 2016 @max123, Think that (well know) BJS checks if your WebGL is capable when loading indexes > 16 bit. If so, limit per mesh is 16,777,216. This could be tripping up the loader though. There is special logic in the Blender exporter to split up meshes unless there are multiple materials for meshes > 65535. I should also mention that BJS's definition of Vertices is likely different than whatever creates a .OBJ file. Not sure the loader does the optimization though. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 13, 2016 Share Posted September 13, 2016 We may need the .obj file to debug. Pinging @Temechon who built the loader 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.