Border shader for random 2D shapes

I am building shapes from datasets and only want to display their outline or ‘border’,

I want to adapt this shader to three,

but i dont know how to write a 2 pass shader for threejs, for a material, if it is possible, are there any documetation, tutorials, examples out there?

You can apply 2 shader materials or patched materials onto a single mesh by setting mesh.material = [material1, material2] ( and adding a separate draw group for the second material 0)

or… you can clone the mesh, and add it as a child of the first mesh, and put the second material on the child. (you may have to fiddle with renderOrder to control the order that the parent/child gets rendered.)

sorry if this wasnt clear, this is the same shader, it would require 2 passes (as in the example)