Skip to content

Add gsplatModifyVS shader customization chunk for gaussian splats#8246

Merged
mvaligursky merged 5 commits into
mainfrom
mv-modifysplat-chunk
Dec 12, 2025
Merged

Add gsplatModifyVS shader customization chunk for gaussian splats#8246
mvaligursky merged 5 commits into
mainfrom
mv-modifysplat-chunk

Conversation

@mvaligursky

@mvaligursky mvaligursky commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Add gsplatModifyVS shader customization chunk

Adds a new shader customization API for Gaussian splats that works directly with rotation and scale instead of covariance, providing better performance and a simpler API. This is non-breaking change, and the existing chunk override functions (with a deprecated warning)

New Features

  • New gsplatModifyVS shader chunk with three hook functions:

    • modifySplatCenter(inout vec3 center) - modify splat position
    • modifySplatRotationScale(vec3 originalCenter, vec3 modifiedCenter, inout vec4 rotation, inout vec3 scale) - modify rotation quaternion and scale
    • modifySplatColor(vec3 center, inout vec4 color) - modify splat color
  • New helper functions in gsplatHelpers:

    • gsplatMakeSpherical(inout vec3 scale, float size) - make splat spherical by setting uniform scale
    • gsplatGetSizeFromScale(vec3 scale) - get RMS size from scale vector
  • Shader chunk validation system via ShaderChunks.registerValidation():

    • Deprecation warnings when old chunks are overridden
    • Support for custom validation callbacks
    • Separate GLSL/WGSL default code comparison
    • Works correctly with app recreation scenarios

The old gsplatCustomizeVS chunk remains functional but is deprecated. A warning is logged when it's overridden. To migrate:

Old (gsplatCustomizeVS) New (gsplatModifyVS)
modifyCenter(center) modifySplatCenter(center)
modifyCovariance(orig, mod, covA, covB) modifySplatRotationScale(orig, mod, rotation, scale)
modifyColor(center, color) modifySplatColor(center, color)
gsplatExtractSize(covA, covB) gsplatGetSizeFromScale(scale)
gsplatMakeRound(covA, covB, size) gsplatMakeSpherical(scale, size)
gsplatApplyUniformScale(covA, covB, s) scale *= s
gsplatMakeRound(covA, covB, 0.0) scale = vec3(0.0)

Updated Examples / Scripts

  • multi-splat.example.mjs - uses new gsplatModifyVS
  • All gsplat shader effect scripts converted to scale-based API:
    • reveal-radial.mjs
    • reveal-rain.mjs
    • reveal-grid-eruption.mjs
    • shader-effect-box.mjs
    • shader-effect-crop.mjs

@mvaligursky mvaligursky self-assigned this Dec 12, 2025
@mvaligursky mvaligursky added enhancement Request for a new feature area: graphics Graphics related issue area: examples labels Dec 12, 2025
@mvaligursky mvaligursky requested a review from a team December 12, 2025 14:56
@mvaligursky mvaligursky changed the title Add gsplatModifySplatVS shader customization chunk for gaussian splats Add gsplatModifyVS shader customization chunk for gaussian splats Dec 12, 2025
slimbuck
slimbuck approved these changes Dec 12, 2025
@mvaligursky mvaligursky merged commit fd561dd into main Dec 12, 2025
7 checks passed
@mvaligursky mvaligursky deleted the mv-modifysplat-chunk branch December 12, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: examples area: graphics Graphics related issue enhancement Request for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants