question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optimize mesh serialization

See original GitHub issue

Every deformable has its dynamic mesh serialized as a unique mesh. This bloats scene file size. It’s unnecessary because the dynamic mesh can be generated from the original mesh. MeshData.DynamicMesh isn’t serialized, but the target (Mesh Filter or Skinned Mesh Renderer) uses it and is serialized. Somehow the targets mesh reference needs to be overridden when serialized, to point to the original mesh. Then at runtime the dynamic mesh can be generated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:22 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
keenanwoodallcommented, Aug 8, 2020

I’ve done a bit more testing and prefabs don’t seem to be an issue! 🤷‍♀️

I made a prefab with a bunch of default deformable cubes GipvCPfH6A It’s only 519 KB image

I put a few of the prefabs into a scene like so QRxMZImv4u

It was super slow, but the scene was only 213 KB! image

There’s definitely still a hiccup when loading a deformable-heavy scene since all the deformables have to initialize, but I’m pretty sure it’s faster than loading all the meshes off disk, so it’s a win in all regards.

If anyone runs into any issues or bugs with the changes let me know. I’d like to merge to main, but wanna be a little cautious so I might wait a bit.

1reaction
keenanwoodallcommented, Aug 5, 2020

oh yup I forgot to mention that part! thanks for catching that!

I think there might be an edge case where already serialized data on a currently disabled deformable won’t get swept with the OnSceneSaving function until you enable first then save the scene then disable and save again

interesting, i’ll look into it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scripting API: Mesh.Optimize
Optimizes the Mesh data to improve rendering performance. This function causes the geometry and vertices of the mesh to be reordered internally in...
Read more >
meshoptimizer | meshoptimizer
Mesh optimization library that makes meshes smaller and faster to render. ... You can then either serialize vbuf / ibuf as is, or...
Read more >
Optimize MeshSerializer (Smaller Size)
I started using the meshserializer and for a model that would usually be 450kb in W3d it comes out to 2.6mb using the...
Read more >
Manual: Compressing mesh data
1. Open the Other Settings submenu and navigate to the Optimization heading. 1. Select the Vertex Compression dropdown and select any channel to...
Read more >
How to save parts, and the idea of Serialization
Just store a list of all the meshes, then instead of storing mesh id, ... its stored in a optimized binary format and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found