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

gltfpack: Use vertex attributes to guide simplification #688

Merged
merged 4 commits into from
May 16, 2024
Merged

Conversation

zeux
Copy link
Owner

@zeux zeux commented May 15, 2024

When -sv command line argument is specified, we will use vertex colors
or vertex normals as part of attribute aware simplification to produce better
results. For now the intention is to use a single argument to
incorporate multiple different types of attributes with fixed weights,
in the future we might expose more detailed control via '-sv?' prefix.

Fixes #652

zeux added 3 commits May 14, 2024 17:38
When -sv command line argument is specified, we will use vertex colors
(if present) as part of attribute aware simplification to produce better
results. For now the intention is to use a single argument to
incorporate multiple different types of attributes with fixed weights,
in the future we might expose more detailed control via '-sv?' prefix.
When simplificaiton debugging is enabled we need to try to maintain
coherence between debug and render simplification options so that the
kind/loops overlaid geometry makes sense.
When -sv is specified we now use vertex normals if necessary; this
improves quality on meshes that don't have colors, although ideally we
should give both to the simplifier.
@zeux
Copy link
Owner Author

zeux commented May 15, 2024

This PR currently uses either color or normal; implementing support for both will require copying attribute data out of source buffers, but is likely valuable - need to do more tests.

Normal effect, before / after:

Color effect, before / after (this model doesn't use textures):

@zeux
Copy link
Owner Author

zeux commented May 15, 2024

Left to right: only using normals, only using colors, using normals+colors (equal weight)

The last one is still not ideal but that's probably because the underlying attribute math needs improvements. But incorporating normals is a clear win over just colors on this model.

@zeux
Copy link
Owner Author

zeux commented May 16, 2024

I think I'm going to merge this as is for now and explore multi stream version separately, as it might also be valuable to do some preprocessing on data (eg linear->sRGB transform for colors for perceptual improvements or some such).

@zeux zeux merged commit 6d6e351 into master May 16, 2024
12 checks passed
@zeux zeux deleted the gltf-simpattr branch May 16, 2024 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gltfpack: Simplification take in account the vertex color
1 participant