Skip to content

Gsplat fix #7696

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 4 commits into from
May 21, 2025
Merged

Gsplat fix #7696

merged 4 commits into from
May 21, 2025

Conversation

slimbuck
Copy link
Member

This PR updates the gaussian clamp to be relative to the viewport size, instead of fixed 1024.

Using a fixed value resulted in too-large gaussians being rendered at lower resolution and actually flooding the viewport with noise.

This update might improve performance at lower resolutions.

@slimbuck slimbuck requested review from a team and Copilot May 21, 2025 15:59
@slimbuck slimbuck self-assigned this May 21, 2025
@slimbuck slimbuck added the area: graphics Graphics related issue label May 21, 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 updates the Gaussian clamp in both WGSL and GLSL vertex shaders to use the smaller viewport dimension instead of a fixed value (1024), preventing oversized gaussians at low resolutions and improving performance.

  • Replace hardcoded clamp max (1024) with viewport-relative clamp
  • Apply changes in both chunks-wgsl and chunks-glsl shader modules

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/scene/shader-lib/chunks-wgsl/gsplat/vert/gsplatCorner.js Use uniform.viewport to derive max Gaussian clamp dynamically
src/scene/shader-lib/chunks-glsl/gsplat/vert/gsplatCorner.js Use viewport uniform to derive max Gaussian clamp dynamically
Comments suppressed due to low confidence (4)

src/scene/shader-lib/chunks-wgsl/gsplat/vert/gsplatCorner.js:49

  • [nitpick] The variable name vmin is ambiguous. Consider renaming it to viewportMin or minViewportDimension to clarify its purpose.
let vmin = min(uniform.viewport.x, uniform.viewport.y);

src/scene/shader-lib/chunks-wgsl/gsplat/vert/gsplatCorner.js:51

  • Consider adding test cases or render tests to verify that the Gaussian radius scales correctly with different viewport sizes, ensuring this relative clamp behavior remains valid.
let l1 = 2.0 * min(sqrt(2.0 * lambda1), vmin);

src/scene/shader-lib/chunks-glsl/gsplat/vert/gsplatCorner.js:48

  • [nitpick] The variable name vmin is not immediately clear. Renaming it to viewportMin or minViewportDimension would improve readability.
float vmin = min(viewport.x, viewport.y);

src/scene/shader-lib/chunks-glsl/gsplat/vert/gsplatCorner.js:50

  • Add automated tests or render validations to ensure the Gaussian kernel correctly adapts when the viewport size changes, preventing regressions.
float l1 = 2.0 * min(sqrt(2.0 * lambda1), vmin);

@slimbuck slimbuck merged commit 3fa8fbc into playcanvas:main May 21, 2025
7 checks passed
@slimbuck slimbuck deleted the gsplat-fix branch May 21, 2025 16:35
@slimbuck slimbuck mentioned this pull request Jun 19, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants