How are scene materials calculated?

I have 2 almost identical scenes, it just uses different models, all models share 15 different materials created in PlayCanvas editor, origin materials generated from .FBX file are unchecked for preload / execute

Scene 1
1
1M
Scene 2
2
2M
Why does scene 1 displays such a high amount of materials? The only difference I did is to set every entity to Static in scene 1, where to look after? Or is this related to meshInstances? Thanks

Found another difference:
Scene1: Most model assets meta attr: Position, Normal
Scene2: Most model assets meta attr: Position, Normal, Texcoord_0

Could this be the reason? Should I be worried due to the “count” of materials?

Internally the PlayCanvas engine material program will gather all the required material properties to compile the minimum number of shaders required.

So the number of materials usually is higher than the number of shaders, and this last bit is what it usually matters.

But 1313 unique materials, that’s indeed quite high. @mvaligursky any idea why Static produces that difference?

1 Like

I think the materials reported by the profiler is material switches within a frame, not number of materials created. So this related to number of mesh instances, and the order in which they get rendered.

2 Likes