Capping clipped planes using stencil on a BufferGeometry()

The important thing is that all relevant stencil passes happen together and that the clip cap rendering happen last in those sets of stencil rendering. That demo has 3 clip caps that have to get rendered and in this order:

  • Clip Plane Surface 1
    • 4x 2x stencil passes with render order 1
    • 1x clip surface as with render order 1.1
  • Clip Plane Surface 2
    • 4x 2x stencil passes with render order 2
    • 1x clip surface as with render order 2.1
  • Clip Plane Surface 3
    • 4x 2x stencil passes with render order 3
    • 1x clip surface as with render order 3.1
  • Geometry surface color
    • 1x geometry rendered with render order 6

After all the stencil passes we render the normal surface of the geometry. TBH the fact that that is rendered with render order 6 is not so important because it does not do anything with the stencil buffer. The geometry surface material is only rendered once though.

1 Like