For the PBRBaseMaterial, _callbackPluginEventPrepareDefines is called before PrepareDefinesForFrameBoundValues and PrepareDefinesForAttributes. This means that defines set by a material plugin can be overwritten by these.
But for the StandardMaterial, _callbackPluginEventPrepareDefines is called after PrepareDefinesForFrameBoundValues and PrepareDefinesForAttributes. This way the plugin gets the final say for these defines.
For example when setting defines for the uvs, they will be overwritten when using PBR materials but the uvs will work when using the plugin with a StandardMaterial.
So here’s a PR that simply moves the call to _callbackPluginEventPrepareDefines to be after the other two calls for PBRBaseMaterial, like it is for StandardMaterial.
Hmm I think for consistency ideally the new event should be added for both StandardMaterial and PBRBaseMaterial, maybe called prepareDefinesBeforeAttributes, with prepareDefines called after all the material plugin helpers like it is for StandardMaterial currently?