Instead of building a custom material entirely, I now use MeshLambertMaterial directly, but use the onBeforeCompile hook to patch its shaders to do our additional work. For this patching I use the shader fragment includes for common / map_fragment, which are available in all shaders (So other materials should work as well).
This should make the code much more future-proof.
Instead of building a custom material entirely, I now use MeshLambertMaterial directly, but use the onBeforeCompile hook to patch its shaders to do our additional work. For this patching I use the shader fragment includes for common / map_fragment, which are available in all shaders (So other materials should work as well). This should make the code much more future-proof.