Doubt about the performance of instanced materials.

Hi all,

I think I have basic problem to understand performance about instanced materials.

I made a Master Material (Brick). Then, I created some instances and tweaked some parameters to get several kind of bricks.

The instances are working so good but if I see the ‘Size Map’ option it seems like the instances are more expensive than create a new material from scratch because instances use default textures from master material and new textures from instance.

5e51af69472cbd8b3037c1b83a9bf6ba4b19f2c4.jpeg
d54400d9d361d09a2c5f59343b4c9d8ee17eefe5.jpeg

However, If I go into my project and take a look to the materials.uasset, the instances seems more cheaper than the master material.

e0035312785588d3a95d0992caae39e184b06cc5.jpeg

I know instanced materials are usefull and we can make all kind of tweaks without incurring an expensive recompilation of the Material, but I don’t understand why the ‘Size Map’ option show me that an Instanced Material can be more expensive than a ordinary material.

Please, can anyone help me to understand that?

Cheers!

The size map tools just shows you the size of all the referenced assets on disk, it does not directly indicate run-time memory usage. For example, in this case you see it references its master material. The textures nested inside the master material are referenced by the master material itself. That does not mean that all these textures are loaded when your game is running and even the ones that are used will be streamed in, so the larger mipmaps might not even be in memory.

A more useful way to find out which textures are eating up your memory is to Texture statics viewer. (open window>statistics and set it to texture stats) This will show you all the currently loaded textures and their memory costs.

Hello Arnage,

thanks for answering and thanks for showing me “Texture Stats”. I did not know about that tool. However, I keep confusing.

I made a simple material with only one parameter (a normal map texture):

SimpleMaterial.JPG

I check Texture Stats and I think it is all right. There is only one reference:

After that I created some instances and I changed the default normal map to a specific normal map. If I check Texture Stats on each instance, I get this:


So, I don’t understand:

  1. It means that base materials need less memory than instanced materials?
  2. The instanced material is more expensive than a base material to use in the scene?
  3. If that is true, how can I take advantage of instanced materials?

So looking at the numbers I assume “T_Brick_Clay_Beveled_N” is used on the instanced and “T_Detail_RockyTest_N” is the one you have as the base?

Either way, one of them is a 1024² texture and the other is 2048². You do realise that a bigger texture resolution causes a bigger impact on the memory, right?

Hello Seirei, thanks for answering.

Yes, you are right. My question here is… why the instance is using the base texture and the instanced texture? I mean, Should not it use only the instanced texture?

Right now, I understand that the Base Material is using 1,365 Mb and the instances are using 6,826 Mb both of them, so I don’t find the advantage of using Instanced Materials if they use more memory than the base material. Maybe, I just don’t understand how ‘Texture Stats’ is working, so that is the why I am asking some help.

Yes, I know and I agree with you. Again, that is the why I don’t understand why an instanced material is using more memory than Master material. Are not the instanced materials causing a bigger impact on the memory?

Ohhh now I get what’s going on on the pictures. That is indeed weird. But sadly it also goes above my head. I hope someone can clear that up, because now I’m also interested.

Going to bump this from 2016 because this happens to me all the time and I still don’t know whats going on?
Especially with more complicated instances it makes the statistics pretty much useless. Anyone know what i’m doing wrong?