Skip to content

feat(WebGPU): add clipping plane support for polydata, volume and image#3464

Open
daker wants to merge 1 commit intoKitware:masterfrom
daker:feat-cropplanes
Open

feat(WebGPU): add clipping plane support for polydata, volume and image#3464
daker wants to merge 1 commit intoKitware:masterfrom
daker:feat-cropplanes

Conversation

@daker
Copy link
Copy Markdown
Collaborator

@daker daker commented Mar 31, 2026

Context

fixes : #2061
fixes : #2293

Results

Implement WebGPU clipping planes for polydata, image and volume rendering,

Use VolumeRenderingWithPolyData example for testing.

Changes

  • Documentation and TypeScript definitions were updated to match those changes

PR and Code Checklist

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

Testing

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js:
    • OS:
    • Browser:

@daker daker force-pushed the feat-cropplanes branch 2 times, most recently from 9095a4b to fe8e279 Compare March 31, 2026 22:17
@daker daker mentioned this pull request Mar 31, 2026
11 tasks
@daker
Copy link
Copy Markdown
Collaborator Author

daker commented Apr 7, 2026

@sankhesh would you mind doing a quick code review?

Copy link
Copy Markdown
Member

@finetjul finetjul left a comment

Choose a reason for hiding this comment

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

Generally speaking, there are lots of duplication. Could you come up with a "helper" that gets injected into the mappers ?

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented Apr 7, 2026

@finetjul thanks for the code review, i will try to improve the code.

@daker daker force-pushed the feat-cropplanes branch 2 times, most recently from 5fd1cde to c0f81bf Compare April 8, 2026 08:58
@daker daker requested a review from finetjul April 8, 2026 08:59
@daker daker force-pushed the feat-cropplanes branch from c0f81bf to bd2cbde Compare April 8, 2026 09:04
@daker daker changed the title feat(webgpu): add clipping plane support for polydata, volume and image feat(WebGPU): add clipping plane support for polydata, volume and image Apr 8, 2026
@daker daker force-pushed the feat-cropplanes branch from bd2cbde to c0e575a Compare April 10, 2026 14:56
model.renderable.getMTime() <= utime
model.renderable.getMTime() <= utime &&
clippingPlanesMTime <= utime &&
activeCamera.getMTime() <= utime
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Considering the camera mtime has a big impact on performance. It means each time the camera is moved the UBO must be rebuilt.

Can you restrain the conditions ?

Copy link
Copy Markdown
Collaborator Author

@daker daker Apr 10, 2026

Choose a reason for hiding this comment

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

do you think this would be sufficient?

const condition = !model.is2D && model.useRendererMatrix &&  model.renderable.getNumberOfClippingPlanes() > 0;

if (
...
(!condition || activeCamera.getMTime() <= utime)
)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i will try to see if i can make them camera independant


if (!hit)
{
traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@sankhesh WDYT ?

@daker daker force-pushed the feat-cropplanes branch 2 times, most recently from b342d93 to cfabfc4 Compare April 11, 2026 11:14
Implement WebGPU clipping planes in CellArrayMapper, VolumePassFSQ
and ImageMapper.
@daker daker force-pushed the feat-cropplanes branch from cfabfc4 to 168099f Compare April 11, 2026 11:18
@daker daker requested a review from finetjul April 12, 2026 12:53
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.

Implement / test WebGPU clipping plane support for PolyDataMapper / ImageMapper Add crop planes to the polydata mapper in WebGPU

3 participants