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

js: Expose reorderPoints and simplifyPoints #622

Merged
merged 4 commits into from
Oct 15, 2023
Merged

js: Expose reorderPoints and simplifyPoints #622

merged 4 commits into from
Oct 15, 2023

Conversation

zeux
Copy link
Owner

@zeux zeux commented Oct 14, 2023

Similarly to reorderMesh, reorderPoints can improve spatial locality of
point clouds, which results in improved compression ratio when using
attribute encoder, and may also improve rendering performance by
improving rasterization locality. On some point cloud data sets this improves
compression ratio by 1.5x-2x.

Similarly to simplify, simplifyPoints can reduce the number of rendered
points while attempting to preserve appearance. simplifyPoints optionally
supports per-point color; unlike triangle mesh simplification, simplifyPoints
is currently guaranteed to reach the requested target because points have
no topology that can restrict simplification, and the function doesn't accept
an error bound. color_weight can be used to adjust the importance of RGB
color relative to position; the recommended value is 1e-2.

reorderPoints is based on an algorithm that has been used without changes
for a few years so it can probably be marked as stable; however, simplifyPoints
might need to be marked as experimental (just like simplifyWithAttributes),
as it may need future interface/implementation corrections.

We currently don't have a great way to mark JS APIs as experimental; this is
something to explore in a separate PR (but before release).

Similarly to reorderMesh, reorderPoints can improve spatial locality of
point clouds, which results in improved compression ratio when using
attribute encoder, and may also improve rendering performance by
improving rasterization locality.
We now support point simplification via a JS interface, both with and
without colors. The order of arguments in the JS wrapper is set so that
simplification without points can just omit the last 3 arguments,
although the resulting order is a little odd when colors *are* supplied.

The function returns the point indices; it's up to the application to
compact the point streams - for triangle meshes we provide compactMesh,
however that only remaps the index buffer. Point vertex data compaction
should be easy enough to implement with a JS for loop.
@zeux zeux merged commit 92801eb into master Oct 15, 2023
12 checks passed
@zeux zeux deleted the js-points branch October 15, 2023 03:55
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.

1 participant