Any plans to minimize duplicate Shader defines, attributes, and sampler binding codes?

I have noticed that there are duplicated codes for binding shader defines, attributes, and samplers in multiple renderers.

Furthermore, the problem is that this code needs to be written to fulfill all the specifications of the engine, and it seems prone to errors due to human mistakes.

For example, in the OutlineRenderer, there is no code to set the uniform and attribute for BakedVertexAnimation, so it causes issues with rendering meshes that use BakedVertexAnimation.

According to the implementation of the standardMaterial, these binding codes are required.

Although there is a code in the MaterialHelper class for binding, it seems that there are classes where the same code is duplicated without utilizing this method yet.


For example, the DepthRenderer and ShadowGenerator classes have almost identical code for binding bone-related parameters, as shown below:

To solve this issue, it seems that something like an “automatic binding object” that removes the duplication of binding codes would be necessary. Is there any plan for refactoring in this regard?

Yes, the refactoring of our renderers (effect layer renderer, depth renderer, geometry buffer renderer, volumetric light scattering post-process, shadow generator, outline renderer) is something we would like to tackle for 7.0, but is not in our top priorities at the moment.

1 Like

Thank you for your response. Personally, I would appreciate it if there is a solution after refactoring that allows vertex offset shaders using PluginMaterial to be compatible with existing shaders.