Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vertex remapping/reindexing with approximate equality #774

Open
pablode opened this issue Sep 26, 2024 · 1 comment
Open

Vertex remapping/reindexing with approximate equality #774

pablode opened this issue Sep 26, 2024 · 1 comment

Comments

@pablode
Copy link

pablode commented Sep 26, 2024

As the README states,

meshopt_generateVertexRemap uses binary equivalence of vertex data, which is generally a reasonable default; however, in some cases some attributes may have floating point drift causing extra vertices to be generated. For such cases, it may be necessary to quantize some attributes (most importantly, normals and tangents) before generating the remap, or use a custom weld algorithm that supports per-attribute tolerance instead.

Since rolling a custom version of the algorithm for a single-line change also comes with a maintenance cost, would it be possible to provide a variant of the algorithm that allows the specification of custom distance functions?

For instance by extending the meshopt_Stream struct or by passing a function pointer to the signature, which then gets the stream and element?

@zeux
Copy link
Owner

zeux commented Sep 26, 2024

Yeah I plan to add support for tolerance based remapping eventually. It would be helpful to have a generic algorithm for this use case.

This is not a single-line change, and exposing a callback isn't quite enough; this requires a different algorithm, and perhaps an interface where the implementation has direct access to floating point values (or not; for normals it might be better to compare the dot product for example).

@zeux zeux changed the title Provide custom distance function for vertex remapping? Vertex remapping/reindexing with approximate equality Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants