reddozen Posted September 1, 2016 Share Posted September 1, 2016 Does anyone know if it's possible to access the LOD mesh data from the parent, and possibly serialize it for later use? I want to serialize, JSON, and save the "new" mesh so it doesn't have to be constructed every time. I have over 2000+ meshes in my scene, and it can take the scene 5~10 min to load on it's own depending on the machine, and adding 3~5 levels of LOD to that and you're talking an hour. So I want to precompile them and load them as an actual mesh. to take some load and time off the scene construction. Something like: var newMesh = BABYLON.SceneSerializer.SerializeMesh(meshes.LOD[j], false, false);newMesh = JSON.stringify(newMesh); I could either load newMesh into my database as a blob, or into a text file with a *.babylon extension. Thinking about it, this would be a good exceuse for a mongoDB database where my babylon files could all be databased.... thoughts for the future. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 2, 2016 Share Posted September 2, 2016 We do not support LOD for now in the babylon.js file format. Per se, the lod is "just" a link between a distance, a main mesh and a child mesh. This could be serialized easily. But I do not see how this could help you reduce the loading time? Quote Link to comment Share on other sites More sharing options...
reddozen Posted September 2, 2016 Author Share Posted September 2, 2016 would it take less time to load 2000 meshes through the scene loader, or have auto-lod create them? That's the test I was hoping to make. I would think there would be a point of diminishing returns. With the loading through scene loader, once they're in the browser cache, they'll load almost instantly. But with the auto-lod they have to load on the fly with every restart. And what I was referring to is how would I access the child (LOD) mesh from the parent. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 2, 2016 Share Posted September 2, 2016 So you are now using auto lod to create load for your meshes and you plan to add lod for meshes in the .babylon file to avoid creating LOD levels on the flight, correct? LOD levels are just meshes (http://doc.babylonjs.com/tutorials/How_to_use_LOD) So to me, you can add LOD meshes in your babylon file and then go through meshes and call addLODLevel(scene.getMeshByName(..)) Does it make sense? Quote Link to comment Share on other sites More sharing options...
reddozen Posted September 2, 2016 Author Share Posted September 2, 2016 Yes, I was going to use the auto-lod to generate the LOD mesh for me save it. Then the next time I load the scene, I load it through Scene Loader and use the addLODLevel. So I am trying to figure out how to get from BABYLON.MESHES to the child LOD mesh and it's LOD level reference. Then I can know that: mesh.LOD[1] = mesh_lod_level1 mesh.LOD[2] = mesh_lod_level2 mesh.LOD[3] = mesh_lod_level3 Maybe that makes more since? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 6, 2016 Share Posted September 6, 2016 Then you can call mesh.getLODLevelAtDistance(distance) to get the mesh associated with a specific LOD level reddozen 1 Quote Link to comment Share on other sites More sharing options...
reddozen Posted September 6, 2016 Author Share Posted September 6, 2016 Thanks DK 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.