Add gsplatModifyPS hook for gsplat fragment color customization#8872
Merged
Conversation
This was referenced Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a user-overridable fragment shader chunk to gsplat rendering, allowing per-pixel customization of the final splat color. This complements the existing
gsplatModifyVSvertex hook: effects that vary across a splat's footprint (e.g. sampling a screen-space texture) can now be done per fragment, avoiding the per-splat popping/flickering inherent to vertex-stage color modification.Changes:
gsplatModifyPSshader chunk (GLSL + WGSL) with a default no-op implementation:void modifySplatColor(vec2 gaussianUV, inout vec4 color)— called in the forward pass after gaussian falloff and dither, before premultiplication.gaussianUVis the fragment position within the gaussian footprint ((0,0) at center, length 1 at the clipping edge);color.ais the final fragment alpha and may be modified. Override it onapp.scene.gsplat.material.app.scene.gsplat.materialto its render material, matching the quad renderer (extends the fix from Custom gsplat shader chunks don't see per-frame uniform updates in unified rendering mode (2.18.1) #8773 to the GPU-sort path), so the fragment hook works on both raster paths. Chunk copy is gated on a content hash to avoid per-frame shader rebuilds.GsplatShaderEffectbase script supports optional fragment chunks viagetFragmentShaderGLSL()/getFragmentShaderWGSL(), and the vertex chunk is now optional too.Examples:
gaussian-splatting/relightingexample demonstrating the hook: a Draco-compressed proxy mesh of the splat scene is lit by standard lights (IBL with rotation/exposure controls, PCSS directional light, gizmo-positioned omni lights with static shadows) and rendered into a screen-aligned offscreen texture by the newGsplatRelightingscript (scripts/esm/gsplat/gsplat-relighting.mjs). The gsplatModifyPS chunk then modulates each splat fragment by the mesh lighting sampled at its own screen position, relighting the splat scene per pixel.Fixes #7438
Fixes #8462