Thanks to @Mugen87 for the clarification, but isn’t there any way possible to work around this problem?
In my app, users are allowed to upload raw files that were 3D scanned. They are not optimized for the web and I have checked all possible ways to optimize them.
No texture needed, I used MatcapMaterial() and eliminated the need for a light source, no shadows, and finally, I used MergeVertex in the BufferGeometry() to reduce the vertices count.
I have also implemented @donmccurdy’s gltf-transform in the backend and activated the MeshoptSimplifier to have the best result, yet there are many faces!
Yes, I don’t have that much vertices in the scene, but there are too many faces! Once there are many elements in the scene, the framerates directly drop.
Using Limited Dissolve with Blender also creates problems (too many Ngons that miss with the light in real-time rendering), but there is a simple fix in there. Using the tris to quads tool solved the problem.
When you go to merge your vertices, are you deleting all other attributes like uv, normal, and color?
It includes all attributes in the merge determination so if any of these attributes vary they will prevent the collapse of vertices, so it’s best to delete everything but position first… iirc.
geometry.deleteAttribute(‘normal’)
geometry.deleteAttribute(‘uv’)
geometry.deleteAttribute(‘color’)
and r.e. running blender on the web, that would be a no… however you can drive/script headless blender on the server to do scripted operations on meshes.
Blender is scriptable via python. Pretty much anything you can do in blender, you can recreate the operation in a .py script in blender.
Blender can also be run “headless” with no UI, like a commandline tool… and you can pass a script to run in the commandline parameters. so you could for instance use node to generate a configuration .py script that calls blender from the commandline, loads up a default template environment for whatever operation you’re doing… and then imports your gltf, which u then run the operation on, and export back out.
ChatGPT can probably walk you through the process.
Using Blender headless scripting features is going to be very heavy for the server. The memory it takes + processing time for every file is quite too much for the server.
I may go ahead and try to find some other ways to reduce the face count. What I aim for now is using low-level code (C, C++, or Rust) and find a way to use it with a web assembly.
Any additional comments will be heavily appreciated
If glTF Transform (using Meshoptimizer internally for simplification, essentially the same as gltfpack in this regard) is not reducing the vertex/face count as far as you need or expect, then this might be a deeper question about the input geometry or parameters. In general, it should be possible to collapse a topologically-connected input geometry to nothing with the most aggressive settings.
Could you share an example of the geometry you’re having difficulty simplifying? There are some known limitations and workarounds possible.