Studio Beta: CSG Has a New Engine - Vroom, Vroom, Vroom!

I see. A bit unrelated, but how much less performant are unions overall, compared to primitives? Our game’s map builder uses unions in quite a lot of places to for instance stop texture fighting between primitives - would it be better to use wedges and slightly more blocks to address the texture fighting, or is it fine to just union these parts? I’m most worried about the collision and rendering implications, though networking as well.

2 Likes

Regarding collision detection performance and union vs collection of primitives.
It really depends on the complexity of the union (how complex the geometry, or shape of the final union is).

The algorithm for collision detection between primitives is pretty simple and efficient (e.g. blocks, wedges, spheres).

For unions, (I am assuming these are static unions, like not composed in-game) the shape is first broken down into convex components once (say when you perform the union in studio) and these components are then checked against for collision using an algorithm which is a bit less performant than the simple primitive-primitive collisions.

However, if you have mixed parts (e.g. primitive colliding against a union) then its always the second type of algorithm that is used.

So I would advise, not to worry too much about the collision efficiency when you do unions - you would not get too much performance improvement if you keep everything in a union as a primitive instead - unless, that is everything in your game can be kept as a primitive.

One thing though - if you are doing unions, and you have to navigate through the shape formed like that (e.g. say you carve stuff out of a block using negative parts and unions, and you want to walk through these cavities) then to get the best fidelity for collision detection, you must select “Precise” collision mode on your part (union). Otherwise you might be bumping into things that are not really there (visually). In this case, a collection of primitives (and not their union) always produces 100% precise collision.

3 Likes

Hi
Is it always true that unions can reduce networking?

I have this physically simulated boat (from the Pirate template):


At first, all the parts where all separate and welded together using WeldConstraints.
When simulating the floating on the server, network receive on the client would be around 20kB/s!

After some trial and error, I tried to union the parts of the boat with the same materials. Mainly the hull.
This way the hundreds of part where drastically reduced. What I noticed was shocking! The client reveive rate per boat was now only around 8kB/s! More than a 2x improvement!

Was this speedup always present with unions? Or is this new?
Does this hold true for all simulated unions?

Anyways, thanks for the amazing work on this!

CC. @Tconnect, @PysephDEV

This might be worth a try!

1 Like

CGS V3 has DEFINETELY improved over last time, however its still unreliable since it cannot really be used on too complex objects and it may or may not break the geometry of some round objects (Ex: Sphere), making those objects look slightly to maybe even very different in some extreme cases, here’s some examples, (2 Is CGS V2, 3 Is CGS V3) Wire Frame Example:

Normal Example:

However so far I do like how better the new engine has gotten, I really like how the new engine is able of making cuts into unions and have those cut areas use different colors. Hopefully we will be able to do the same for textures too, this could save A LOT of time and be INCREDEBLY useful!

1 Like

While this does look more promising, this is only networking - I’m more-so worried about collision and rendering times (see mrrblato’s post, if you have any gaps to go inside the ship you’d need to use ‘Precise’ collision mode which is much more expensive)

3 Likes

Thanks for the feedback.
The differences you’re seeing between V2 and V3 for the spheres example is due to how the sphere is triangulated. We did use another way of modelling the sphere, which we now think may not have been the right decision. We are going to revert back to the V2 sphere which is made of stripes of quads. This should make the geometry of the CSG meshes more regular.
As for the ability to transfer the textures on cut parts, could you please share a model exhibiting the issue? I will have a look and check whether this is something we can do.

4 Likes

This was not an issue I’ve experienced, I was only saying how it could be useful if we had that ability, so far we can only do this with different colors. And here is an union that I’ve cut colors into… colounionn.rbxm (25.4 KB)

Also again, I am only saying that it could be useful if we could cut different textures and colors into parts.

1 Like

Will this random unalignment “bug” be fixed later in the new version. It has been around forever and still is in the newest version.

1 Like

Can you share that model? Happy to have a look at that issue.

1 Like

Hey, I was using the new engine for a little bit until I encountered a bug where balls and cylinders in a union would either expand or shrink when you hit the union button. I made a topic a while back, but it was flagged due to me posting in the wrong category. I’ve done some testing and I know it wasn’t from a plugin, and it stopped happening when I disabled the newer version of CSG. I think the new update is great, but this bug has been pretty annoying for me and a few others. And I’m pretty sure @Laatikkoxx commented about the same issue I was having. So could you possibly look into it? My topic does demonstrate the issue better in case I didn’t explain it too well here.
Thank you in advance.

2 Likes

Hi, I have reproduced the issue (with the rbxl file you attached in the other post) and I think I understand the problem. Not sure if it’s exactly the same issue as @Laatikkoxx though (would appreciate a rbxl file for that one). I will work on a fix.

2 Likes

Not sure if it matters if it’s rbxl or rbxm so I added both.

union.rbxl (50.6 KB) union.rbxm (24.3 KB)

I’ve had that problem too, I also have it with SpecialMesh Sphere.

2 Likes

Thanks. Both formats are fine. I think I know what’s going on here. One workaround is to select the single cylinder next to the union and to click union (I admit it’s weird to union a single shape). This should ensure both meshes fit perfectly.
I will work on a fix for that problem. Stay tuned…

5 Likes

I’m sorry if I completely missed this but is the csg api going to be available in localscripts?

1 Like

I know it isn’t now, but I wanted to know if it will be available for localscripts

Hi, the current beta is limited to Studio only.
In-game csg3 scripting is something that is planed as the next step (and is in the works).
This would use an API similar to csg v2 in-game api.

1 Like

Hi all, we’re working on a plan to enable this in-experience and not just within Studio. As part of that, we want to have a careful rollout. If you use CSG in-experience and would be willing to have this enabled on your place, could you DM me? Thanks!

8 Likes

Hi
I’m always getting this error when trying to union many parts: image

This prevents me from unioning many parts together or two large unions together.

The error only happens when using the new CSG engine.

1 Like