Currently, I am in the process of developing a web application that utilizes three.js for rendering 3D models. One of the features I have already implemented is the ability to create a project by selecting a base model (which can be in various formats such as .obj+.mtl, .3ds, etc.). Now, my next task is to add a save feature that will allow users to save the active three.js scene to the server as a JSON file. However, one major issue I am facing is that the size of the exported file ends up being extremely large.
For instance, when I convert a 24MB obj+mtl model (including textures) into a text file using JSON.stringify(scene.toJSON()), the resulting file size balloons to 208MB! Transmitting 208MB of data to the server every time a user saves their work isn't practical or efficient. To address this challenge, I've been exploring options for creating a patch file that captures the differences between two JSON objects representing the same scene data. While this method helps reduce file size, there are still limitations since the initial transfer to the server requires sending the complete file.
In an attempt to decrease file sizes, I experimented with exporting the same model without the mtl file, resulting in a much more manageable 31MB file size. My main question now is whether there are techniques available for exporting scenes without including textures. If so, how would I go about reconstructing the scene from the exported file and specifying the texture path for loading textures? Additionally, I'm seeking guidance on the most effective approach for saving a three.js scene to the server. Given my limited experience in this area, any corrections or suggestions are greatly appreciated.