How to combine gradient shader material with mesh origin material

Not so long ago, there was a question on discord about a force field and how to show its border on objects in a scene.
I wrote an example, that uses .onBeforeCompile() for MeshStandardMaterial:

The solution also works for instanced meshes:

3 Likes