what is the best way to create a low poly mesh from a CAD file (step) that is optimized for threejs?
I get the best quality result when I convert the CAD file to Collada (dae) with FreeCad. When I now import the file into Blender, no artifacts are visible, but the mesh has 4.500.000 faces. If I export directly from FreeCad to gltf, there are only 500,000 faces, but many artifacts are visible.
I am not satisfied with either result, because I don’t want artifacts, but I also don’t want a mesh with millions of faces and therefore a large file size.
To avoid having to remodel the model, I would like to know how best to convert the CAD file to a low poly glb?
Have you tried to simplify the mesh in Blender before exporting to glTF? Blender provides multiple tools that might help in this context. I would probably start with the Decimate modifier: Decimate Modifier — Blender Manual
I already tried that but this method leads to a messed up geometry.
Since the CAD file contains the clean data of the model I am looking for a solution that creates a clean low poly model out of it directly.
Other than reporting a bug to FreeCAD, it does not sound like you have good options for direct export from FreeCAD. Most CAD tools create very unoptimized models for rendering, unfortunately. I would suggest trying to get a “correct” glTF model first, with whatever tools you have available and without worrying about size/performance yet. If you can get that far, there should be a number of options to optimize the model.
The COLLADA2GLTF commandline tool is one option, or Blender is another. Note that Blender scenes should use Principled BSDF Materials for export – i’m not sure what your imported Collada file will use by default.
I am able to create a “correct” gltf file by converting from step to collada with FreeCAD and the converting from collada to gltf with Blender. But this leads to a mesh with 4.500.000 triangles and a 300-400mb file.
It’s very disappointing that there is no sophisticated option
From there you might try something like this in a command line:
npm install @gltf-transform/cli
gltf-transform optimize input.glb output.glb --simplify-error 0.00001 --compress draco
Joining and decimating things in Blender is also an option. Sometimes CAD models have a lot of very small, very detailed parts that are not easily visible in the scene… these should really be removed but can be a pain to deal with.
If you want to post the model somewhere, people might be able to share other ideas.
I tried different methods and I got the best results by using this plugin for blender: STEPper