Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
137 stars 2 forks source link

Mesh/Material merging with auto texture Atlasing #736

Open troyBORG opened 11 months ago

troyBORG commented 11 months ago

Is your feature request related to a problem? Please describe.

Reducing avatar file sizes for an Optimized/Baked version of models/meshes.

Describe the solution you'd like

An example I can think of is the Statue Creator. Instead of having all your materials and textures it would be nice to be able to merge all the meshes and textures into one giant mesh that does texture atlasing to get the textures.

Describe alternatives you've considered

Something that does what this tool does: https://markcreator.gumroad.com/l/Polytool

Additional Context

Here is an example texture for the Cannis for example of how it would pack the textures... Canine_rig_VRC_PublicDefault VRChat PC (Good, Fallback-compatible)_MainTex

You can see how stuff like the Fluff that didn't need to be as high of a resolution was represented smaller on this texture pack...

Geenz commented 11 months ago

I eventually want to do this as part of a larger optimization effort for the existing renderer - though I want to add some level of automation to it along with some explicit tooling for it.

This will only really work for objects that don't really have any texture scaling (either in UVs or on the material itself) as a heads up. But generally it should be pretty doable.

Frooxius commented 11 months ago

This is something I was planning on adding before too, as there's been a bunch of work that I've done with the mesh baking and so on. Having this as a tool would be generally beneficial to the creators.

This is completely independent of the renderer, as it happens on the FrooxEngine side - at very least that's the way it should be implemented, same as the other mesh baking and texture processing options.

We need good packing algorithm for the UV regions however. We can treat them as boxes, which we already have algorithm for (it's used for the font atlases when rendering text), but that can leave quite a bit of unused space. Then if it actually considered polygonal UV regions, but that needs a more advanced packing algorithm, to pack things more tightly.

Geenz commented 11 months ago

@Frooxius I was going to look into some UV atlas and packing libraries to help with the eventual lightmapping work. Could potentially piggyback off of that to further optimize for this.