after creating an mesh my geometry object size is 100 mb appx i want to compress it to very small like 10 mb is it possible
The following example might be interesting for you:
https://threejs.org/examples/webgl_buffergeometry_compression
However, GeometryCompressionUtils
wonât be able to reduce the size by factor 10.
@Alex please share more details. Is the data all geometry, or textures and animation too? Do you need to compress it within the webpage, or would offline compression tools work for you? Does the geometry need to be 100% lossless, or is lossy compression OK as long as the final result still looks the same?
@donmccurdy i have only one terrain mesh i want to compress its geometry object and than i do toJSON to store in DB and when i parse and recreate the mesh nothing should be change the terrain mesh should be similar as before please suggest me how i can achieve this.
Regards
Alex
Is it a flat heightmap / terrainmap, or does it include complex stuff like caves / boulders / trees etc. ?
For what you described, the best approach would be to divide the entire mesh into tiles and load / stream only the visible parts. Something like this approach shown on the screenshots.
You can also then store the tiles in the DB separately, indexed by their position.
Can you show a sample of how exactly the geometry looks like? Maybe compression wouldnât even be needed.
Hello @mjurczyk its a dxf terrain so i think it does not have complex caves and all but still i want to go for geometry compression upto a very good extent
i also find this DRACOLoader but how i can compress the geometry only i dont have any drc file how compression is possible and decompression of objects
Thanks to all who respond on this ticket because some time responding is also a motivation a developer feel some one is there to help this issue is fixed.
I used the zipson package that compressed the mesh json form and it is working fine according to my need
Hey Don,
Whatâs the optimal process for lossless (or lossy along as visually remains the same) compression of OBJ geometries and textures if you are going to convert the OBJ to GLB anyways to display on web. Is it better to compress as OBJ using DRACO then convert to GLB or is it better to convert to GLB first then compress via GLTF Transform? Thanks.
The OBJ format doesnât support compression, so compressing it will always involve converting to something. I think generally itâs best to have fewer moving pieces and formats involved, so my suggestion would be:
- Convert OBJ to glTF, as losslessly as possible
- Optimize the glTF (using glTF Transform, gltfpack, or other tools)
Often the file will benefit from more optimizations than just Draco compression â like vertex welding or simplification â and glTF-to-glTF tools are pretty good at this.
For step 1, that would involve using THREE.OBJLoader then export it to a glTF using the THREE.GLTFExporter. Are there best practices to ensure its as losslessly as possible?
That or GitHub - CesiumGS/obj2gltf: Convert OBJ assets to glTF perhaps. I would just try it and see how it looks in glTF, before trying to do any optimization. Converting between formats always means changes to materials, which might or might not need to be cleaned up.