There is actually a couple things to consider when trying to use a ShaderMaterial as built-in material in disguise basically. I made a plugin for this to handle it more easy, it also adds more very useful features such as clean patching, sharing uniforms and creating derivative materials with previous applied patches, sharing lights uniforms globally etc:
Especially maps THREE needs in order to setup the right constants, which if you do it hardcoded will often conflict.
Also:
// this strangely causes the texture to be myOtherTex
uniforms:THREE.ShaderLib.standard.uniforms,
You’re assigning the libraries uniforms without cloning them. The entire set of uniforms isn’t even required though, the plugin also will only use which you define or set as null, and will add any necessary that require default values.