Web GPU Camera cutting into mesh

I have recently migrated from WebGL to WebGPU, after interacting with the scene for a while I start to get, what I thought to be a minZ issue, where the camera cuts into the mesh but it is inconsistent.

Here are the properties for my camera.

camera.lowerRadiusLimit = 1;
camera.mode = cameraMode;
camera.panningInertia = 0;
camera.panningSensibility = 5;
camera.minZ = 0.001;

When I first load and begin interacting with the scene, I can zoom in and out with no issue:

After a while, the issue presents it’s self:

Yes, it really looks like it’s clipping by minZ. Are you sure minZ has still the same value when that occurs?

Also, without a repro, it will be hard to investigate more, unfortunately.

1 Like

I wish I could there is too much IP / confidential company information to share the repo. I’ve console.log(scene.activeCamera.minZ) on an interval and consistently and I am getting the 0.001. Is there anything else I can log or profile to get a better understanding?

Sorry this might be totally dumb….

But in the second vid, it seems like the mesh itself has moved position? So maybe the cam is keeping the original distance, but because the mesh has moved it’s now clipping inside it?

This also might sound “dumb”, but perhaps the models you’re using are very tiny as-is. Try setting the value EVEN LOWER than 0.001 like 0.0001 instead and see if it’s even having any affect on the camera clipping at all

I just rotated to a different angle

I have resolved the issue.

The root cause was depth peeling (OIT) corrupting the WebGPU depth buffer after compute shader passes. The fix was: disable depth peeling, use reverse depth buffer for better precision, raise camera.minZ to 1, and properly enable/disable edited meshes instead of toggling visibility.

I used Claude Code to help me with this one, I am going to working with our compliance team to see if we can release the sculpting aspect of this.

4 Likes