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
NVIDIA RTX 3070 8GBs DX12