I cannot build a PCS/SPS with a different UV set (i.e. Texture.coordinatesIndex to VertexBuffer.UVKind / UV2Kind, etc.). Babylon always picks UVKind - other kinds not evaluated. Therefore, in my case, PCS/SPS meshes become black.
Only solution I could think of was to override the PCS and SPS classes. But this is difficult to maintain because the methods you have to override are quite large
The fix should roughly be the same (https://playground.babylonjs.com/#WLDCUC#206). But, in the playground, see line 170. You might be required to clone the source material instead of just assigning it. Not sure if this can be handled on the SPS side for the user?
This time I don’t consider it to be a bug because the SPS does not/can’t assume that you are going to assign the same material than the one used by the mesh you passed to the digest method.
You could call digest several times with different meshes, and if some materials use uv set 0 and others use uv set 1 for the diffuse texture, then you will have to create a specific material for this SPS mesh, the SPS can’t automatically create a material suitable for the mesh. So, I consider it’s the user responsibility to create (if necessary) the material used by the SPS mesh.
That’s why you will have to explicitely enable this mode by passing uvKind: -1 through the options when calling digest: