Skip to content

Gaussian Splatting: Use half-precision for spherical harmonics evaluation on WebGPU#8441

Merged
mvaligursky merged 1 commit intomainfrom
mv-SH-half-float
Feb 4, 2026
Merged

Gaussian Splatting: Use half-precision for spherical harmonics evaluation on WebGPU#8441
mvaligursky merged 1 commit intomainfrom
mv-SH-half-float

Conversation

@mvaligursky
Copy link
Copy Markdown
Contributor

@mvaligursky mvaligursky commented Feb 4, 2026

Summary

  • Converts spherical harmonics (SH) evaluation to use half-precision types for improved performance on GPUs with f16 support
  • Changes SH coefficient array type from array<vec3f, SH_COEFFS> to array<half3, SH_COEFFS>
  • Updates all SH format readers (uncompressed, compressed, SOG) to output half3 coefficients

Performance Impact

  • Halves memory usage for SH coefficient arrays when f16 is supported (90 bytes vs 180 bytes for 15 coefficients)
  • Keeps all SH math in half precision end-to-end, reducing register pressure
  • Falls back to f32 automatically on devices without f16 support via the half type aliases

Copy link
Copy Markdown
Contributor

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 optimizes spherical harmonics evaluation in Gaussian Splatting by converting it to use half-precision (f16) types on WebGPU, reducing memory usage and improving performance on GPUs with native f16 support.

Changes:

  • Updated spherical harmonics evaluation to use half-precision types (half3, half4, half) throughout the computation pipeline
  • Modified all SH data readers (uncompressed, compressed, and SOG formats) to output half3 coefficients
  • Converted all SH constants and intermediate calculations to use half precision with automatic fallback to f32 on unsupported devices

Reviewed changes

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

Show a summary per file
File Description
src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatEvalSH.js Converts SH evaluation function to use half precision for constants, intermediate calculations, and array types; returns vec3f for compatibility
src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplat.js Updates SH coefficient array declaration from vec3f to half3 in vertex shader
src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/uncompressedSH.js Modifies readSHData functions to output half3 arrays with explicit half3 constructors for all three SH_BANDS configurations
src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/sogSH.js Updates SOG format reader to output half3 coefficients with proper type conversion
src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/compressedSH.js Converts compressed format unpacking to use half4 for intermediate values and half3 for final coefficients
src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplatCopyToWorkbuffer.js Updates fragment shader's SH array declaration to use half3 for consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@willeastcott
Copy link
Copy Markdown
Contributor

willeastcott commented Feb 4, 2026

Does this mean the work buffer can use float16 to store coefficients as well?
Are we compromising visual in any way?

@mvaligursky
Copy link
Copy Markdown
Contributor Author

Work buffer stores only color .. we resolve SH every few degrees and store resolved values to keep rendering fast. But those are float16.

@mvaligursky mvaligursky merged commit 1c9d3ec into main Feb 4, 2026
14 checks passed
@mvaligursky mvaligursky deleted the mv-SH-half-float branch February 4, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue performance Relating to load times or frame rate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants