Hello. My friend owns a game and was wondering how he could optimize it, as it is currently very laggy to play, even if there are no scripts enabled. He has around 25K unions, which he made before he learned about the performance downside they bring. These unions range from 2 basic parts unioned together to save space in the explorer, all the way up to complex buildings and models in one union. Would there be a way I can optimize these unions whether it be via studio or an external program I write (such as a python program that changes the unions into meshparts in the rbxl file) ?
All help is greatly appreciated, thank you.
You can change the unions to meshparts by right clicking a union in the Explorer and selecting “Export selection.”
Keep in mind multiple unions selected will fuse into 1 mesh
Then, use the 3D importer to import the converted unions back to Studio.
yes. do this 25 thousand times.
Will it give any visible performance boosts though or will it just change the name from Union to Meshpart?
Jesus christ at that point restart.
What is the point of this? You aren’t even optimizing the mesh you’re just changing the instance type
Does anyone know how games like Jailbreak have big maps and thousands of parts, but still no lag?
streaming enabled, or some kind of instance streaming solution.
Make sure to optimize your collision, touch, and shadow properties. Disable them if they are not needed for every part. If possible, reduce the quality of the collision mesh as long as it doesn’t have visible issues to the player when they walk on it or near it.
Also consider taking a look at resources that explain it better than me!
Its not the instance count that will take a toll on performance but really the tri count
If you are having performance problems, you could try using streaming enabled or scripting your own sort of “distance based culler” that turns certain far away parts transparent
Fyi unions arent inherently bad themselves, they are marked this way because how Roblox generates them results in ugly topology. Although Im pretty sure Roblox released a newer version of CSG which helped this problem, so depending on when your friend created the map, the problem may or may not be as bad as it seems
This isnt the most accurate way, but a quick way to see the tri complexity is by enabling Wireframe Mode. If it looks bad, that should be a good enough say that you need to look into a solution
Hey, I’ve been using Unions for years, and below are some of the ways I’ve found that can greatly reduce the lag Unions give
Starting off, union itself is already laggy in nature due to the way it works, so if you can, you would be better off converting it to a mesh by right-clicking the Union → Save/Export → Export Selection, you should receive a file type .obj after exporting, then simply inserting that file back to Roblox Studio using “Import 3D” at HOME page. Meshes were made in a way to optimize triangle counts so obviously it would be less laggier than Union
However, if you wish not to turn into a mesh, which is understandable since multiple parts with different colors keep their colors after union (not the case for mesh), then you can try a few steps below
- Changing CollisionFidelity
-
Basically what you can do is to change CollisionFidelity of that Union to “Box”, which would simplify the hitbox of that Union to just what a part hitbox would be like
-
This is usually my to-go solution since it makes the engine calculate the hitbox in a much simpler way, which reduces lag. If your game requires a precise hitbox (Ex: Obby) then I wouldn’t recommend this, or you can try “Hull” instead
- Changing RenderFidelity
-
Changing RenderFidelity to “Automatic” would also help reduce the lag too as it reduces the amount of details shown based on your camera distance from the Union itself
-
Not as efficient as CollisionFidelity but it can somewhat help
- Disabling CanCollide and Enabling Anchored
-
Another way is to set CanCollide to false and Anchored to true. Setting CanCollide to false is pretty much self-explanable and setting Anchored to true will disable any physics on it
-
This should be your last resort and often does not impact much
Again, unions are already laggy themselves, and if you can, convert them to meshes instead
Hey Skybloxtest123561 ,
I understand the struggle of optimising massive amounts of unions. I and my colleagues had to optimise the game before the big summer update, we had over 50,000 Unions. Luckily we managed to bring it down by 95%.
We would normally use unions to make our life easier and building quicker, but the way how the unions are made behind the scenes is horrible and are completely up-optimised. So for a start, I would replace every union with a whole in it with 4 parts scaled correctly to make a whole, use individual parts to make gaps and what not. if you know what I mean. Here is an example:
Now, what if you wanted to make something that you had to union no matter what and was not possible with individual parts? Or if it was possible with individual parts but the part count would be too high for it to be possible? Then you could use meshes instead, using blender you could make optimised, while high quality meshes for the best experience.
I would highly not reccomend you export your union to blender and re-import it into studio as a mesh, because automatically Roblox makes their unions so unoptimised, and you can clearly see this in Blender. Here is an example:
You can see how terrible unions are from the above image. Watch how it looks if you simply make it as a mesh on Blender:
- It is optimised
- You dont have to go through the hassle of importing than exporting and unions and etc
I hope this information helps you and solves your problem!
Try using the Triangulate modifier on your blender tube there, Roblox does this to every mesh in game, that’s why it looks “unoptimized” (it’s actually not bad)
The reason for this is that pretty much every rendering engine will break everything down into triangles first, so storing them that way is faster than remeshing every frame
If you import your Blender mesh into Roblox, then export it back into Blender, you’ll probably see something very similar to the Roblox Union mesh
People modelling stuff in Blender (or any other software) who prefer to work with Quads, don’t do it for performance or optimization reasons, but because it’s a lot easier to work and make things with quads instead of triangles.
(another note, your blender mesh looks clean because a lot of vertices aren’t being rendered. Try applying your Solidify modifier!)
Hello, thank you very much for replying this info! Unfortunately, almost all of the unions have these options enabled in some similar way or other, and the workspace has Streaming enabled as well. Once loaded into an area the unions get only slightly less laggier, but once you walk into an unloaded area it bombs FPS. As this is an open world game, this is a very crucial component. Any ideas on this?
Hello! I will try my best to reduce the hole unions by hand, but I am wondering if there would be a better way to automate this? Thank you!
Hi! If the instance count does not affect performance, could I just separate my unions? The current problem with my unions isn’t that they contain negative or intersect parts, it’s just that they are simply multiple parts grouped together into a union. If I was to separate these union groups, would performance increase, decrease, or stay the same? Thanks!
I understand, I don’t think theres a current way to automate this procedure unfortunately.
Thank you for the information, I will research more on it