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
However there’s the
main issueof Depth. if I for example render my object i.etrianglesuch that it’s slightly occulded by the simple cylinder rendered by VTK (2nd render pass). It completely discards the 1st pass (custom triangle). This is perhaps obvious because the composition is lacking depth information prior to compositing. Hence my issue. When I useGetZbufferDatajust after myOffscreen renderingit never returns the correct depth values for the cylinder but its counterpartGetRGBACharPixelDataworks.Does anyone know the best way to get the depth buffer correctly without any convolution involved? @jaswantp @sankhesh @dgobbi