donmccurdy / glTF-Transform

glTF 2.0 SDK for JavaScript and TypeScript, on Web and Node.js.
https://gltf-transform.dev
MIT License
1.3k stars 145 forks source link

simplify: attribute weighted simplification #1335

Open marwie opened 3 months ago

marwie commented 3 months ago

Hello, currently simplify doesn't take vertex colors into account. Looks like meshoptimizer added this feature recently. Is this already exposed/available in gltf-transform?

https://github.com/zeux/meshoptimizer/issues/652#issuecomment-1922083991

donmccurdy commented 3 months ago

Not yet exposed – see #1153. It's marked as an 'experimental' feature, so we would need to do something like that here, as I assume the meshoptimizer API could change at any time. In the meantime, vertex colors only factor in to the extent that they limit welding vertices before simplification.

marwie commented 3 months ago

Ok - thanks for the link!

marwie commented 3 months ago

Here's also another very very simple model where this would help (it would probably not remove any vertices in this simple case)

BenchSmall.zip

image

kzhsw commented 3 months ago

Also have a look at https://github.com/donmccurdy/glTF-Transform/discussions/992

donmccurdy commented 3 months ago

It looks like there are breaking changes planned for the simplifyWithAttributes API, which is still experimental:

https://github.com/zeux/meshoptimizer/pull/601

I think the rest of this task – supporting simplifyWithAttributes — will need to wait for a 4.1+ release.