The following example demonstrates how you extend a built-in material.
In this particular case, MeshLambertMaterial
is enhanced so it does support instanced rendering. You should be able to use the same approach for MeshMatcapMaterial
.
Please use the mentioned example as a code template. If you have problems adapting the code, please share your progress of work as a live demo.
BTW: There is actually a whole article about extending materials in three.js
: https://medium.com/@pailhead011/extending-three-js-materials-with-glsl-78ea7bbb9270
Creating a custom material is not always necessary. Sometimes a code injection via Material.onBeforeCompile() can also do the trick.