SelectionBox Instances use 12 draw calls each

Hi Engine Team, I’ve been investigating performance optimization in my physics-heavy game Noob Crusher Tycoon, inspired by @MrChickenRocket’s talk on Using Roblox Tools to Improve Performance. During my analysis, I discovered an unexpected behavior related to selection boxes and draw calls.

Observation: Selection Boxes and Draw Calls

In an empty workspace, I found that each selection box contributes 12 draw calls, which seems excessive. Here’s what I observed:


A single part with a selection box uses 13 draw calls:

  • 1 for the base part
  • 12 for each selection box itself (1 for each “part” of the box)

This behavior appears suboptimal when compared to a custom solution:

A custom selection box using parts with Neon material requires only 2 draw calls:

  • 1 for the base part
  • 1 for the Neon material on the custom selection box parts

This high draw call count for selection boxes could impact performance, especially when multiple (around 50 at once) are used like in my case.

Selection boxes are great because they alow for quick addition of a clear point of interest
In my use case its to highlight buttons the player can step on.

Creating multiple different sized custom selection boxes for my use case is not realistic because of replication when constantly changing the transparency of hundreds of parts at once every few seconds

Here is my provided Test Place with my custom selection box (2 draw calls) and the default selection box (13 draw calls)
SelectionBoxDifferences.rbxl (54.0 KB)

if there are any misunderstandings about how draw calls function please inform me!

8 Likes

The 4 corners count as “parts” also im saying parts because each part has the wireframe of a basepart

3 Likes

this isnt really a bug, its just how its designed. maybe they can add occlusion culling to each “part” to help with performance

1 Like

Seems like a performance heavy oversight. Definitely worth fixing. I believe studio itself uses this object when re-sizing so definitely needs to be optimized.

Yep, studio does directly use the selection box, so selection box should be actively supported by the engine as I doubt they would purposefully use a unoptimized object in core gui.

2 Likes

A bit unrelated,

but the other 2 selection objects are beyond broken. I am honestly surprised that selection box still works pretty well to this day. Sad that selection objects are treated this way. Making them with parts means more memory for physics properties when we just want to make an outline.

Surface Selection is also used in core gui when you apply a decal to a face of a part yet it is so broken, the transparency property doesn’t work and some other issues.

3 Likes

Unrelated, but you’re telling me the new CoreGui is built on old systems that have been left abandoned?
I wouldn’t be surprised if the CoreGui and TextChatService ran on wierd niche abandoned roblox things and if those things actually caused more performance loss than react

Either way, I feel like roblox engineers should be made aware of the fact that something which presumably isn’t deprecated is absolutely falling apart

3 Likes

Agreed, I wanted to believe it is deprecated but I checked and it’s not. The core gui does use select instances that are not being maintained for whatever reason. A bit odd… maybe they just don’t know but it’s been a long time since they broke and they still broken.

1 Like

TextChatService is separate from this. In Studio, CoreGui is just another service for displaying things related to UI like StarterGui, and in this case it is not really relevant to the Roblox GUI of the Client. Studio probably uses these things because it’s always used them, and they try and port things 1:1 even across entirely new systems.

1 Like

Breaking news everyone!

Surface selection is deprecated yet it’s used in studio core gui

Yet it is not marked as deprecated

Why did they depreciate this and why is it not marked as depreciated!?

I made a bug report for this: Deprecated object is not marked as deprecated

I also made this one: Selection instance that is not marked depreciated

Its weird that they would deprecate surface selections even though they are actively using them in studio as you mentioned

1 Like

I did a bit more testing in my tycoon.

with 3 nearly full tycoons it was 1800 - 1900 draw calls when using roblox’s selection boxes
with 3 nearly full tycoons it was 900 - 1000 draw calls when using my own custom selection boxes.

This is nearly a 2x improvement in performance!!!

I would love to see roblox rework their selection boxes and surface selections since they are used ALL THE TIME when editing things in studio and in games.

I worry that a new developer will overuse selection boxes and surface selections not knowing how performance heavy they are and have a laggy game because of it.

1 Like

SelectionBoxes actually appear to use a variable amount of draw calls depending on your distance to them. I discuss it a bit in my reply here but in some cases, SelectionBoxes don’t even increase the ‘scene’ draw call count at all and instead just directly increase the ‘total’ draw call amount!

2 Likes