Skip to content

Speed up sogs centers calc #7669

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

Merged
merged 3 commits into from
May 14, 2025
Merged

Speed up sogs centers calc #7669

merged 3 commits into from
May 14, 2025

Conversation

slimbuck
Copy link
Member

This PR implements faster sogs centers generation.

This code is executed during scene load, so worth improving.

This change results in around 25% faster execution on a 4M gaussian test scene (468ms -> 343ms).

@slimbuck slimbuck requested review from a team and Copilot May 14, 2025 14:05
@slimbuck slimbuck self-assigned this May 14, 2025
@slimbuck slimbuck added area: graphics Graphics related issue enhancement labels May 14, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the performance of SOGS centers generation during scene load by optimizing the per-iteration computations.

  • Removed the per-iteration Vec3 allocation and created a more efficient loop using precomputed buffers.
  • Introduced direct bit manipulation and math operations to calculate centers, reducing execution time by roughly 25%.
Comments suppressed due to low confidence (2)

src/scene/gsplat/gsplat-sogs-data.js:196

  • [nitpick] The local variable 'means_u' shadows the destructured variable 'means_u' from earlier. Consider renaming it (e.g., 'mu_val' or 'upperMean') to improve code clarity.
const means_u = means_u_data[idx];

src/scene/gsplat/gsplat-sogs-data.js:197

  • [nitpick] The local variable 'means_l' shadows the destructured variable 'means_l' from earlier. Consider renaming it (e.g., 'ml_val' or 'lowerMean') to improve code readability.
const means_l = means_l_data[idx];

@slimbuck slimbuck merged commit 1e6664d into playcanvas:main May 14, 2025
7 checks passed
@slimbuck slimbuck deleted the centers-dev branch May 14, 2025 14:17
slimbuck added a commit that referenced this pull request May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants