Invalidate Part Material - Microprofiler Tag

Hello !
With the release of the new native max framerate setting in Roblox, optimizing every part of any project has become paramount to ensuring that players can enjoy one’s experience at their desired framerate.

For some times now I have been trying to track down something related to materials that allegedly takes 1ms every frame to properly update/prepare before rendering. The tag is called “InvalidatePartMaterial”.

Despite the tag table doc I was unable to find any sort of documentation or third party documentation online remotely mentioning this tag. We’ve known for years now that those kind of tags are always very difficult to understand because they are often undocumented and they lack any in-studio description, but more often than not someone has already asked the question and a vague answer clues us in to what to do to tackle the issue.

However, this tag seems to be somewhat new and related to the new-ish material variants. In fact, the reason I am making this bug report is because of the following reasons:

Step 1: I test-play on studio, and by default, after the map is loaded and all instances / materials are replicated properly within the following minute, the InvalidatePartMaterial tag indicates 1ms of processing time in the Prepare/UpdatePrepare tags as seen in the following screenshot:

Keep in mind this happens everyframe, and I have no idea what is causing the issue, so this is 1 whole millisecond of rendering thrown down the bin.

Step 2: While trying to track down the issue, I deleted ALL material variants from the game, WHILE in test-play. This effectively removes the entire tag, granting me 1ms of additional rendering time. Great, this proves the issue is indeed related to material variants.

Step 3: Again, still during the same test-play, I paste back all the materials in the MaterialService. Roblox instantly recognizes the material names and applies them back to all instances that were missing the material variants, even terrain, effectively reverting back to the previous state before I deleted all materials. However, this time, the tag is still fully gone, effectively fixing the entire 1ms prepare issue.

I do not really know what else to do. For me this seems like the Material variants are meant to be invalidated once or differed over some frames; but this does not seem to stop and the 1ms code is as a result ran every frame for the entirety of playtime. Removing the materials and adding them back to fix the issue is definitely a very hacky workaround and I doubt this would be viable during actual playtime as more instances are created and I have yet to find out if the issue happens and adds-up per-instance or simply per-material.

Typically, the fact that the issue “fixes itself” onces the materials are cut/pasted back in proves me that this invalidatePartMaterial phase is not meant to happen every frame, because the game runs just fine and with no issues whatsoever without it.
Additionally, having the tag table documentation updated to include some more obscure tags would be really neat. Even just having a short description of what the tag means and what is happening under the hood can be tremendously helpful for us.

Link to the project: [STAFF] Misc Place - Roblox
System info:
Windows 11
AMD Ryzen 7 5800X
48GBs of DDR4 ram at 3200mhz


Bumping since this is limiting the performance of my game where I’m trying to squeeze as much performance as possible in a realistic amount of time.

1 Like

Bump again, can I get a validation from a staff that the issue has been noted down and an internal ticket has been filled for it ?

Thanks for the report! We’ll follow up when we have an update for you.

1 Like

Thank you so much for your response :saluting_face:

Hi Lyzrinn. The project you link to in your original post is private so I can’t access it. Could you make the place public, or better, provide a copy of the .rbxl file? This will help us investigate the issue more easily

Hello ! Thank you for your reply. I had thought you guys had accesses to places despite them being private. The game is confidential, so I will instead provide a copy of the rbxl file in DMs if that’s fine with you. Once a map loads in, you’ll be able to see the tag in question in the microprofiling.

1 Like

Hello guys. For anybody in the future wondering what the solution is, here’s a follow-up.

We’ve continued our exchange with the staff in DMs, it turns out that a specific material was causing the issue: I was updating a material’s StudsPerTile every frame to get a specific effect, which was causing the engine to invalidate that material any time this happened.

Removing said material kept the references (so no errors) but as a result it didn’t invalidate any terrains nor parts anymore, and so the phase / tag was removed in the microprofiler.

Obviously, this was a “hacky” workaround to get a very specific effect that wasn’t really necessary, just some nice visual details. An identical effect can be seen here

I do not recommend anybody to change materials at runtime every frame.
Again, big thanks to the engineering staff for helping me out with this one. I will mark this as the solution now and the bug report can be closed.

1 Like