Recently, wgsl shader support was added for PBRMaterial and StandardMaterial, and materials are now loading shader source at runtime via async import.
Using async imports in this way allows the browser to download only the shader source the user needs at runtime, which reduces load times similar to the effect of reducing bundle size.
However, the Material Plugin does not currently provide an API to load shader source using asynchronous functions like this.
I would like to have a function like MaterialPluginBase.getCustomCodeAsync or the API changed to allow MaterialPluginBase.getCustomCode to return a Promise.
Or maybe there’s a better way.
This feature is also needed in order to effectively support wgsl code with the Engine’s current built-in features such as greasedLine and reflective shadow maps.
Material Plugin also needs to know if the current material is using wgsl code, so it can do some if branching.