# VTK WebGPU - DepthBuffer issue

**URL:** https://discourse.vtk.org/t/vtk-webgpu-depthbuffer-issue/16488
**Category:** Support
**Created:** [July 20, 2026, 5:15pm UTC](https://discourse.vtk.org/t/vtk-webgpu-depthbuffer-issue/16488 "2026-07-20T17:15:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Seun](https://discourse.vtk.org/user_avatar/discourse.vtk.org/seun/32/767_2.png) [@Seun](https://discourse.vtk.org/u/Seun)
#### Post date: [July 20, 2026, 5:15pm UTC](https://discourse.vtk.org/t/vtk-webgpu-depthbuffer-issue/16488/1 "2026-07-20T17:15:58Z")

</div>

Hello guys,

I was wondering if someone has experienced this or perhaps I’m approaching this task the wrong way. I am currently testing out a bunch of things regarding WebGPU, however I can’t seem to get the Depth buffer to work, values keep coming back as `1.0` which I suspect is default value.  
However, getting the Frame Buffer via `GetRGBACharPixelData(....)` works fine but `GetZbufferData()` for Depth Buffer doesn’t work.

note:

- I’m on a macOS, building an application with a custom view using a custom metalLayer

- the custom metal layer is to replace that which WebGPU creates for its window, for I need ownership of mine. This is how I’ve been doing it over the years with CAOpenGLLayer

- due to how Metal works, I would need to present my own drawable after completion of rendering but VTKWebGPU also needs to present its own. this leads to flickering since both have different drawable (consequently different textures) and webgpu or shall I say dawn does not expose other ways to specify using the specific drawable (texture) to render into.

- Much of the issue stems from the fact that dawn doesn’t expose much that could help give finer control of the render loop. So I decided the best way was to have 2 different render passes 1 for my custom rendering in Metal, the 2nd for VTK, both would render into different textures and then I’ll composite both before I present. This will require VTK to not present its rendering (offscreen rendering) - this worked great. No more flickering

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [July 20, 2026, 7:02pm UTC](https://discourse.vtk.org/t/vtk-webgpu-depthbuffer-issue/16488/2 "2026-07-20T19:02:35Z")

</div>

Hi @Seun, Could you please try the changes from [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/13483](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/13483)? I think there was a format mismatch that was causing the compute shader to cop-out early.

---

<div class="post-metadata">

### Author: ![Seun](https://discourse.vtk.org/user_avatar/discourse.vtk.org/seun/32/767_2.png) [@Seun](https://discourse.vtk.org/u/Seun)
#### Post date: [July 21, 2026, 1:26am UTC](https://discourse.vtk.org/t/vtk-webgpu-depthbuffer-issue/16488/3 "2026-07-21T01:26:04Z")

</div>

Hi Sankhesh,  
thanks for the suggestion. I’ll definitely give it a try and get back to you.
