CustomMaterial Bug - Uniforms cannot be updated for meshes that have a vertex color property

I noticed a problem that custom material shaders do not work correctly if some of the imported geometry has vertex color properties. Uniforms for these meshes simply do not pass parameters, and are equal to zero by default. Here is a playground with a simple example. There are two boxes imported from 3dsmax. The left one is just a simple mesh, the second box is a mesh with baked vertices colors. As you can see, only the left box reacts to changes in Uniforms. https://playground.babylonjs.com/#ZPDU00#1

But, on the other hand, when the boxes both have a vertex color, everything works fine. The problem arises when applying a shader to meshes with different properties.
https://playground.babylonjs.com/#ZPDU00#2

It’s a bug in the CustomMaterial (and PBRCustomMaterial), will be fixed by:

2 Likes