Non-Uniform Union Scaling Beta

[Update] August 15, 2022

This feature is now live, more information can be found here: Nonuniform Unions: Now Available on Production


Today we’re introducing a beta feature that allows Unions created using the CSG system to scale nonuniformly.

Enabling this Beta

You can find it in the Beta Features dialogue in Roblox Studio:

image

What does “allow nonuniform scale” mean?

Without this beta enabled, if you resize a Union and a MeshPart with similar contents, you’ll find that they have different scaling behavior. Specifically, Union scaling is letterboxed such that the union contents only scale uniformly:

image

With this beta enabled, Unions will instead have identical scaling behavior to MeshParts, allowing non-uniform scaling of the contents:

image


What’s the Catch?

This may seem like the “obvious” way that things should have worked, to begin with, so there’s got to be some tradeoff that we’re making here to change the behavior right? You would be correct, there are a couple of things that we need your feedback on before we commit to releasing these changes.

Separate Behavior Changes

In a world where unions can only be scaled uniformly, separate always cleanly works because every part resulting from the separation of a uniformly scaled union can be exactly represented.

The same is not true for nonuniformly scaled unions. For example, the results of separating this stretched union of a box and sphere clearly won’t be representable with primitive parts:

In order to deal with this, we give developers two options in the case where a union with parts that can't be represented separately is being separated:

image

  • Reset Scale: The union will be returned to exactly the size it was first created at before it is separated. This option is best when you intend to re-union the constituent parts after editing them.

  • Apply Scale: The scale will be applied as “closely as possible” to the constituent parts. Specifically, the mass/volume of the parts and the general direction the parts are facing will be the same before and after they separate.

Here’s an extreme “Apply Scale” example where all of the parts in the union must be approximated. The red is the stretched union, and the translucent gray parts are the result of separating it:

image

While working on models with the beta enabled, let us know which option ends up being more useful and if the popup gets in the way.

Existing Nonuniformly Scaled Unions

As pictured at the start of the post, you can actually nonuniformly scale unions right now, it just applies often undesirable letterbox scaling. This means that there are some non-uniformly scaled unions out there. Currently, this beta reinterprets the scale of those existing unions, such that they now fill the bounding box rather than being letterboxed. We have three options here:

  1. Release as-is: If the impact to places is very low, we could release with the current beta behavior. That would be a breaking change because the size of the physics and render geometry for existing nonuniformly scaled unions in places would change.

  2. Provide a rollout flag under workspace: We could temporarily provide a developer-controlled rollout flag under the workspace so that developers have a significant period of time to adjust to the change.

  3. Provide a permanent per-union flag: We could provide a per-union property that controls the scaling behavior of that particular union, with new unions defaulting to the new behavior and old unions remaining on the old behavior.

Option three is currently the least preferred as writing third-party tooling such as plugins that properly deal with both scaling behaviors at the same time would be challenging. The plugin ecosystem would likely be fragmented with only some plugins properly dealing with both scaling behaviors.

We are leaning towards option two, but we need your feedback on this. Please let us know how many noticeable visual artifacts you see in existing places and if you find any gameplay breakage (e.g.: Not being able to pass through a gap you could before).

F.A.Q.

  • What if I want to uniformly scale a union?: Holding the Shift key while scaling any object (including a Union) with the Scale tool will scale it uniformly.

  • So you’re messing with my existing unions?: Possibly, but only if they were non-uniformly scaled with letterboxed scaling. Let us know how many noticeable changes to your places there are when the Beta is enabled so we can choose the best rollout strategy.

  • Nonuniform unions act weird under CSGv1: Creation using CSGv1 (“Enable Legacy CSG”) is deprecated. While legacy content created with CSGv1 is still supported, new CSG system features such as this may not work correctly when you have CSGv1 turned on in Studio.

  • My Union isn’t nonuniformly scaled ingame: The feature is still a Studio beta and not enabled in live games. If you really want to use a nonuniformly scaled union in a live game you can create a new union containing only that union to create an unscaled copy which could be used in a live game already (though if you try to Separate/Union it further in a Studio session without the Beta enabled you’ll get weird results).

  • I ended up with a union with a misaligned bounding box!: There’s a rare edge case where if you union more parts onto an existing union with a letterbox scaled union inside of it you can end up with a misaligned bounding box. Separating and re-unioning the misbehaving union should fix this in the unlikely event you run into it.

Wrap-up

We’re excited to see what creation possibilities you’re able to unlock with this improvement!

275 Likes

This topic was automatically opened after 10 minutes.

A small delay in getting this feature enabled. It should be enabled momentarily. I will update this comment when it is.

This feature is now live, happy testing!

43 Likes

Has the algorithm that is responsible for the faces on the union changed at all to be more optimized or is it still the same old stuff? Unions while being a helpful tool also cause a large amount of lag, considering(from my understanding) they’re supposed to be a tool that allows users to make complex shapes without using any external 3D modeling software.

8 Likes

Can you union a non-uniformly-scaled UnionOperation with other parts?

10 Likes

As I’ve mentioned elsewhere, avoiding forked scaling behavior is very desirable, plugin behavior around this would be horrendous, and existing games most likely were only scaling unions in the past for rare alignment purposes with the old draggers, or by accident / negligence. As a developer and plugin developer it would be much more streamlined to get rid of forced uniform scaling entirely. It doesn’t make sense to be in the API forever, we can already scale uniformly with tooling if we choose to.

6 Likes

Yes, the separate behavior is the only gotcha, they’ll otherwise work just like any other union would have with regard to unioning, collisions, rendering, etc.

13 Likes

I would like to see how this affects hitboxes (if at all) as well as the masses and the apply scale feature specifically with more complex unions.
Furthermore, unions are often frowned upon by builders if in high quantities due to their “lag” compared to meshes and parts which of course is bound to happen; is performance notably affected with this new scaling?

1 Like

This beta only addresses the scaling behavior, but there are a lot of other CSG system improvements being worked on as well.

11 Likes

I cant describe how amazing this feature is, however, will it ever come to multiple parts so that they behave the same when scaling?

6 Likes

Woah I can make new shapes.

The lighting seems to be different for non-uniform scaled unions when their CollisionFidelity is set to default. The one on the left is a large block with a hole cut in it, the one on the right is the small union shown in the middle, but stretched out and enlarged.

I didn’t notice any lighting differences for Box, Hull, or PreciseConvexDecomposition CollisionFidelities, though.

Does this mean that non-uniform union scaling will be enabled for all places at some point in the future (with existing union reinterpretation?)

Is it possible to have an option where only new unions have the option to be non-uniformly scaled, or to disable this new form of scaling altogether for certain places? I have showcases where I used plugins to non-uniformly scale my unions, and a lot of my models would be altered if this change were to be forced.

Anyways cool update.

14 Likes

This is a nice update! I would love to have the ability to scale cylinders, corner wedges, spheres, and wedges non-uniformly as well.

19 Likes

Wow nice little future you guys are adding!

3 Likes

Maybe eventually but the Builder Tools Team has valued keeping the Scale tool in Studio predictable over allowing it to do this (basically it would be hard to predict what the scaling behavior for a given model is because it would depend on what parts there are hidden away somewhere within it).

For now I would recommend looking at community plugins for nonuniform scaling of Models, there’s a few good options out there.

10 Likes

alright

and I personally already use F3X for this very thing when scaling multiple parts but hope to see it built in some day

8 Likes

Now Roblox should work on optimizing unions for large scale maps.

8 Likes

Good observation.

What’s going on here is not really anything new with this beta, it’s something that you always have to be aware of when using the CSG system. But it’s also possibly something you’ll have to be a bit more aware of if you’re scaling things in a significantly non-uniform way:

  • The collision geometry of a CSG part does not change when you scale it, it just gets scaled.
  • “Default” collision fidelity is scale-sensitive, it uses a uniform grid system to determine the physics decomposition.

Putting these two facts together, you’ll have to make sure that if you’re using Default collision fidelity, you create your CSG at a large enough scale that any holes you care about don’t get “filled in” by the Default decomposition algorithm, because they’ll still be filled in when you scale up the part, the decomposition won’t be recomputed.

Aside: I would highly recommend using PreciseConvexDecomposition for the majority of your CSG parts. The main case where Precise causes issues is with MeshParts that have complex curved surfaces, but the majority of CSG parts are better served by Precise (or Hull / Box for things you don’t need detailed collisions on)

17 Likes

Maybe just a little bit overdue but still a welcome feature.

6 Likes

You can actually do this now! You just need to union it all by itself and then stretch it!


It would be nice to have a better way to do this though.

This is the best way to do it if you don’t want to make a mesh in another program.

7 Likes

Unions are generally a bad practice imo. I’d rather use a more optimized method.

7 Likes