Should I use Unions to reduce the part count for the grass, upload several separate sections as Meshes or just leave them as Parts. Which will give the best performance?
My guess is to just union them if possible. I wouldn’t leave them as parts.
You should union each section of grass individually.
Making them all unions likely won’t give you much if any of a performance boost. Not to mention unions could also have terrible boundaries. Making meshes and using those on the other hand will give you an increased load time - though better run-time performance.
If the grass is the same shape, use the same Union for each grass (as in, Union one, and copy/move that same Union Part to the other grass area), don’t Union each grass section because that will create multiple Unions of the same shape, which doesn’t work for instancing. Better yet, use a MeshPart since that can be much more optimized and useful in other situations.
Although generally that’s not a lot of Parts anyways so if you wanted to leave them as Parts, it should be fine.
I believe using unions is less performant than just having the parts separated because the parts can be instanced.
I thought parts were better than unions when it comes to game performance?
@Aotrou provides really good advice and I’d like to elaborate a bit on it.
There is a myth that you can reduce lag by grouping parts into a single union, but this is not true! Here’s why:
- When you create a union, Roblox Studio needs to remember what parts the union is made out of in case you want to revert the process. So for each union, the data of the parts it exists out of is also stored. As far as I know clients won’t download this data during gameplay, but the server will still have it remembered! So by creating a union that is only used once, you increase memory usage!
- When a union is created, Roblox Studio needs to calculate its geometry (its shape) which is hard to do optimally, so usually the number of tris/faces will be higher than it needs to be. This makes unions more expensive to draw than when you would remake the union as a mesh. Regular parts are easier and faster to draw since their shapes are consistent (they are always rectangular)
- The only time when unions could perform better than parts is when you reuse one unique union many times, but usually you could just use a mesh for that as they do not have to store extra data (see #1) and their shapes are more optimized (see #2)
So in short, keeping your parts as is, is better than unioning them all together. I would only use unions if:
- Having one instance makes programming/developing easier than a group of parts. (e.g. when animating swords)
- You want to create a shape you cannot make with regular parts, but installing/using a 3rd party software like Blender would be too much effort for the task.
To answer the original question:
Given that your grass has a convex shape, you could upload a couple of meshes for the grass and reuse those throughout your build. Reusing them will mean that you will only have to store a couple of unique shapes for the grass, and the Hull shape makes collision calculations fairly cheap. On top of that you will reduce the total number of tris/faces that have to be drawn as you can eliminate the ones you do not see (which is not the case with regular parts! It could perform better than having as many parts as shown in your picture, but it is difficult to tell. But at least those meshes will make development a bit more convenient a you have fewer instances in the workspace.
Unions are actually instanced now (as far as I know) so multiple of the same unions can be drawn in one call. But the reason why parts are really performant compared to unions is because they are really well optimized due to their simplicity.
Unions are not good for performance whatsoever as they were not made with performance in mind, and therefore should only be done for small operations (definitely not with a lot of parts.)
They also use much more memory and processing than parts.
My advice is to use normal parts still or use meshes instead.
Unions are no different from meshes at the render level - in fact, union data is stored on the game where meshdata is loaded, so you’re actually incurring more network penalty by having to Http Request them in post-game load.
The only advantage is the ability to perform your own poly reduction in a tool like blender.
They do not always use much more resources than parts - if you use a union in place of a few parts, then it will be less efficient, but if you use a union in specifically suitable situations, and you do not give it a complex render hull, then it will be likely far more efficient than the same number of parts.
My advice was to remake it as a mesh using blender (should have made that clearer) and like I said unions are fine for simple operations but not recommended for large scale things.
However I was unaware that it could in some cases be more efficent then parts so thanks for the information.
I would union, but be wary that sometimes unions break quite easily, which could lead to full game corrupt.
I’m not sure what you’re inferring - I am not aware of any issues with unions that could corrupt an entire game file?
If you’re aware of one, please report this as a ROBLOXCRITICAL issue as this could meet the criteria in Proper use of "ROBLOXCRITICAL" in Bug Reports [outdated]
Please report it here: #platform-feedback:studio-bugs
Not sure if that would corrupt the entire game though.
last time I made 1 union in a concept place, the next day the game fully corrupted. Isn’t that normal for roblox?
I would Not union everything together. You Should union them in groups.
This is not normal at all.
Please report this as a critical bug to Roblox staff immediately.
Unions have a higher triangle count, so its less performant.