Skip to content

fix(WebGPU): pass depth-equal fragments in the translucent pass#3548

Open
sedghi wants to merge 1 commit into
Kitware:masterfrom
sedghi:webgpu-oit-coplanar-depth
Open

fix(WebGPU): pass depth-equal fragments in the translucent pass#3548
sedghi wants to merge 1 commit into
Kitware:masterfrom
sedghi:webgpu-oit-coplanar-depth

Conversation

@sedghi

@sedghi sedghi commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Context

The order-independent translucent pass depth-tests with depthCompare: 'greater' (reversed z) against the opaque pass depth buffer, so translucent fragments that are exactly coplanar with already-rendered opaque geometry are rejected and silently disappear. The common case is a translucent overlay on an image slice — e.g. a segmentation labelmap or fusion layer — which renders on the OpenGL backend (equal depths pass in its translucent pass) but not on WebGPU.

Found while running Cornerstone3D segmentation overlays on the WebGPU view API. Related: #3547 (independent fixes from the same effort).

Results

  • Coplanar translucent geometry (labelmap/fusion overlays on slices) renders on WebGPU, matching the OpenGL backend.
  • Regular translucent-behind-opaque occlusion is unchanged (greater-equal still rejects strictly farther fragments).

Changes

  • WebGPU/OrderIndependentTranslucentPass: depthCompare: 'greater''greater-equal'.
  • New regression test: opaque slice + exactly coplanar 50%-opacity overlay; asserts the overlay blends over the slice (renders black without the fix).
  • No API changes.
  • Documentation and TypeScript definitions were updated to match those changes (none needed — no API changes)

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

WEBGPU=1 NO_WEBGL=1 npx vitest run \
  Sources/Rendering/WebGPU/OrderIndependentTranslucentPass/test/testCoplanarTranslucentDepth.js

Fails without the fix (expected 0 to be greater than 60), passes with it. Requires the WebGPU adapter flags for headless Chromium added in #3547's vitest.config.js change when running before that lands.

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js: master (07c3e9a)
    • OS: macOS 15
    • Browser: Chromium (Playwright, headless) and Chrome, Apple Metal adapter

The order-independent translucent pass depth-tested with 'greater'
(reversed z), rejecting translucent fragments exactly coplanar with
already-rendered opaque geometry — e.g. a labelmap or fusion overlay on
an image slice, which silently disappeared. Use 'greater-equal',
matching the OpenGL backend where equal depths pass in the translucent
pass.

Adds a WebGPU regression test (coplanar translucent overlay over an
opaque slice).

@daker daker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@finetjul finetjul requested a review from sankhesh July 13, 2026 12:39
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.

2 participants