Skip to content

Add optional depth prepass and explicit SRP splat rendering#37

Draft
andybak wants to merge 13 commits into
wuyize25:mainfrom
icosa-mirror:pr/depth-prepass
Draft

Add optional depth prepass and explicit SRP splat rendering#37
andybak wants to merge 13 commits into
wuyize25:mainfrom
icosa-mirror:pr/depth-prepass

Conversation

@andybak

@andybak andybak commented Jul 16, 2026

Copy link
Copy Markdown

This PR adds an optional alpha-tested depth prepass for Gaussian splats. The prepass
allows opaque scene geometry and sufficiently opaque splat regions to participate in
depth compositing while retaining the normal transparent color pass.

A new Depth Prepass Alpha Cutoff project setting controls which splat fragments
write depth. Its default value is 1.1, which disables depth writes and preserves
the existing rendering behavior until the feature is explicitly enabled.

The change also moves URP color drawing into explicit renderer-feature passes. It
supports both the legacy command-buffer path and the Unity 6 Render Graph path.
HDRP's custom pass explicitly sorts and renders the color pass so HDRP rendering is
not suppressed by the SRP-specific draw path.

Main changes

  • Add GsplatSettings.DepthPrepassAlphaCutoff with a project-settings field.
  • Add depth-only shaders and materials for:
    • Spark-compressed splats
    • Uncompressed splats
    • Globally merged splats
  • Add cached depth-material variants for SH bands and render orders.
  • Add per-renderer and global depth-draw methods.
  • Add explicit color and depth passes to the URP renderer feature.
  • Support both CommandBuffer and Unity 6 RasterCommandBuffer rendering.
  • Make the HDRP custom pass issue the color draw after sorting.
  • Preserve the built-in render-pipeline draw path.
  • Apply camera culling masks to per-renderer SRP draws.

Behavior

  • A cutoff greater than 1.0 disables the depth prepass.
  • Lower cutoff values allow more splat fragments to write depth.
  • The normal color pass still performs splat blending.
  • Global sorting uses a matching global depth material when enabled.

Risk and compatibility

This PR touches the built-in, URP, and HDRP rendering paths and has the widest
rendering impact of the extracted branches. The default setting is intended to keep
depth writes disabled, but the explicit SRP color path is still a structural change.

This branch currently contains Unity-generated material and .meta lines with
trailing spaces. Those lines came from the original assets and may be normalized
separately if required by the upstream repository's formatting policy.

Suggested testing

  • Verify splats render with the default cutoff in built-in, URP, and HDRP projects.
  • Test Spark and Uncompressed assets.
  • Test global sorting both enabled and disabled.
  • Enable the depth prepass and verify occlusion against opaque scene geometry.
  • Test several cutoff values, including 0, a mid-range value, 1, and the disabled
    default of 1.1.
  • Verify Game, Scene, and additional cameras with differing culling masks.
  • Test Unity 6 Render Graph and the pre-Unity-6 URP command-buffer path where supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant