Expose simplifyRatio to the optimize CLI
Closed this issue · 2 comments
Is your feature request related to a problem? Please describe.
Using the gltf-transform optimize
cli, exposing the simplifyError
argument is useful to control the simplify operation amount. When using the simplify
without prior weld
yields to bad simplification results, where ratio is not correctly used - which is expected since the vertices are not weld'ed, which optimize chains under-the-hood.
Describe the solution you'd like
It could be useful to also expose simplifyRatio
as a CLI flag to the optimize
command, so optimize command could be used as a single all-in-one operation to aim for a target simplification amount, constrained or not by error.
Describe alternatives you've considered
A simple workaround as of today is to either run gltf-transform weld && gltf-transform simplify
or gltf-transform optimize && gltf-transform simplify
subsequently. Exposing the simplifyRatio to the optimize CLI would just be a nice-to-have.
Additional context
Reference to the simplify doc:
ratio=0.0, error=0.0001: Aims for maximum simplification, constrained to 0.01% error.
ratio=0.5, error=0.0001: Aims for 50% simplification, constrained to 0.01% error.
ratio=0.5, error=1: Aims for 50% simplification, unconstrained by error.
@jo-chemla This sounds like a good addition! Would you be up for making a PR? The bindings for the 'optimize' command are defined in packages/cli/src/cli.ts
-
glTF-Transform/packages/cli/src/cli.ts
Lines 236 to 245 in 8a3a130