Hi!
I recently did setup a vertex shader using material nodes and TSL.
Unfortunately I noticed some clipping issues when a mesh with that material shader is moved significantly far from its original position. My guess is that some clipping data is not updated and the update code has been overwritten in the vertexNode
.
What happens is that randomly if the mesh is significantly displaced, rotating the camera around makes it clip in/out of existence.
That’s nothing to do with custom clipping planes. I’m not doing any of that.
I can confirm that this is once I apply my custom vertexNode
that the clipping issues appear.
I have a working example of the issue here : https://codesandbox.io/p/devbox/glsl-dqs-to-tsl-2j7lkn
Reach the mesh using orbit controls, zoom a little bit and you will quickly notice how just rotating the camera around poorly clips it in/out.
The problem is that I have no real idea about how GPU clipping works and what Three.js need to update in terms of clipping data to make it work.
What I’ve learnt from the source code is that it asks for clippingContext
to the node builder and uses intersectionPlanes
and unionPlanes
to compute clipping.
Is there a uniform in the shader I need to update with my vertexNode
transforms to update the clipping?