Per-instance Clipping with ShaderMaterial

I have lots of instanced geometry in my scene, some InstancedMeshes and some instanced LineSegments. I have a clipping plane that cuts away part of the geometry, and this works great on the instanced meshes, but not very well on the instanced LineSegments. The LineSegments use InstancedBufferAttributes and a ShaderMaterial to transform each individual instance. The clipping plane seems to be getting applied to the original LineSegments geometry, not the instances, so when the instances are transformed, the clipping doesn’t appear consistent.


The above image was taken of this fiddle which is a watered-down version of what my project entails. The green meshes have blue cap faces where they have been clipped. The red LineSegments instances are supposed to be clipped by the same plane. The lower red line instance is in the original position of the geometry, so that clipping is correct, but the other instances, which were translated, have been clipped in the exact same way as the original geometry, but they shouldn’t be. I expect each instance to get clipped according to its position and rotation related to the clipping plane. InstancedMeshes do this just fine. I assume this is just something I need to do in the ShaderMaterial.

Does anyone know how to get per-instance clipping to work properly for InstancedBufferGeometry which uses a ShaderMaterial?