Write to depth in compute shader

I’m using a compute shader to render a point cloud to the screen. I’m now facing the problem of making this technique compatible with babylonJS’s standard renderer. Currently, the compute shader simply renders to a screen-sized quad, directly overlaying the point cloud onto the rendered scene (ignoring depth/occlusion). I know it’s possible to get the depth map using DepthRenderer, which i can use for depth-testing. Is it also possible to write to the depth map from a compute shader? That way, I could avoid having to render the point cloud only after all other objects have been rendered.

1 Like

cc @Evgeni_Popov

1 Like

This section of the specification says depth textures are read only, so writing from a compute shader would not be allowed. I asked for confirmation in the Matrix channel, I will let you know the outcome.

[EDIT] I can confirm it’s not supported at the moment (maybe in the future?).

3 Likes