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

Further gsplat shader refinements #7185

Merged
merged 7 commits into from
Dec 9, 2024

Conversation

slimbuck
Copy link
Member

@slimbuck slimbuck commented Dec 9, 2024

This PR is a followup to #7169 and further refines the chunk layout for gsplat material:

  • Gaussians now have 3 data structures:
    • SplatSource - stores the splat's data uv, id and render order
    • SplatCenter - stores the splat's center in camera and clip space
    • SplatCorner - stores the splat's corner offset (from center) in clip space and the corner uv
  • The functions initSource, initCenter and initCorner populate the respective structures and are placed in their own chunks for easy customisation
  • Each chunk now declares and uses its own global variables (uniforms and attributes)

Also:

  • Reflection vector for SH evaluation is done in the main function so it can easily be customised
  • Slightly faster early-out when gaussian is behind the camera
  • Disable clipping of splats by the near and far clipping planes (clamp depth instead)
  • Replace tex_params uniform with call to glsl textureSize

// stores the camera and clip space position of the gaussian center
struct SplatCenter {
vec3 view; // center in view space
vec4 proj; // center in clip space
mat4 modelView; // model-view matrix
Copy link
Contributor

Choose a reason for hiding this comment

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

With clustered lighting, I had precision issue when a mat4 was stored in a struct, so I had to move it out. Not sure it would have the same impact here, likely not as shadow flickering is a specific issue.

@slimbuck slimbuck merged commit fd10688 into playcanvas:main Dec 9, 2024
8 checks passed
@slimbuck slimbuck deleted the gsplat-shader-dev branch December 9, 2024 11:44
slimbuck added a commit that referenced this pull request Dec 9, 2024
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.

3 participants