Jump to content

Serialize LOD Mesh


reddozen
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

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...