Unions causing lag?

There are quite a few threats discussing how unions may lag the server and client. I would just appreciate and answer in my usage of them as apparently it varies on the usage of them.

In a nutshell, my entire game is loaded with unions, however, I wouldn’t say that they are that detailed. I’m sure each union doesn’t that have many ‘triangles’ as there are around 20~ parts for every union. This will add up though as the game is pretty large.

The blue outlines show different unions within the game.

I’ve noticed that when I move the camera to different areas, the framerate sometimes drops from 60fps to 40fps. On lower end computers, this could be horrific.

Would you recommend tons upon tons of unions or, separate these unions but have loads of parts? I don’t not want to go on every single union and separate them to find out that it made no difference.

EDIT: This area for example will sometimes take 10-20fps away.
https://i.gyazo.com/983ec1bae68a11853478f362cc377f63.mp4

Thank you! :slight_smile:

5 Likes

Never union parts just for the sake of unioning them, they use much more memory and processing than the individual constituent parts.

Edit: CSGV2 Has made this less true, in many cases unions are now more efficient. Once part instancing is out it likely won’t matter much between the two.

9 Likes

Yeah I’ve learned that the hard way; don’t union to make things easier.

2 Likes

Alright, looks like I’ll be coding a plugin tomorrow to ununion everything.

Thank you both for your quick responses! :slight_smile:

2 Likes

Yeah, don’t use unions always haha.

Use a mix between unions, meshparts, and parts - watch zeuxcg’s talk at RDC

3 Likes

If you watch that talk, the takeaway should be that it’s often advantageous to make unions. It’s certainly not true that a bunch of parts are more efficient or use less memory. Unions are usually the winner here. Part instancing is nearly upon us, but unions are already instanced, and have been for a while, so they are really good when you want to copy-paste a bunch of them to build something larger (as long as you don’t change a property that thwarts instancing Part Instancing - pre-release announcement). A perfectly-crafted mesh has the potential to beat everything else, but the new CSG system is very good and for some of the unions I’ve made, the results were as optimal as if I’d made the mesh in Blender.

That said, un-unioning some old unions, made with the old CSG system, then turning CSG v2 back on and re-unioning may result in more optimal parts. Try it for yourself and check the triangle count. Be sure to do it in a new place with copies of your work, because there is no guarantee that the new union will be textured the same way. I know even if I take apart an old union very carefully, putting it into a new folder with each Separate step, I still can’t necessarily remember what order I had the pieces selected when I originally unioned them, or how it was oriented in the world (also affects texture mapping, things get box-mapped in world coordinate space, last time I checked).

5 Likes

Ah, this is very useful. Thank you for the information.