Do invisible parts boost, or decrease performance?

I’d like to briefly start with, this is my first DevForum post, so I’d like to apologize for any mistakes or errors.

My main question I’m presenting here is, do transparent parts (with their Transparency set to 0) cause performance issues, do they increase performance, or do they do nothing at all? Let me elaborate.
Below (hopefully) explains a little more of what I’m trying to get at. There are 9 parts, all with collisions on.

Now, below (again, hopefully) you see the same 9 parts, but with a 10th also, this 10th part (.5 transparency for visual representation, it would be entirely transparent in a real-world use) The difference here is the previous 9 (visible) parts have their collisions off, with the transparent part being the only part that has collisions on.

My whole point in this post at all was my concern for performance in my (and others) games. I know it can be difficult to optimize our games, so I figured I’d shed some (possibly?) new light on an additional way to (potentially) optimize our games.

I know I could be completely wrong in thinking this increases performance, but that’s why I’m writing this at all.

I haven’t been able to test this theory of mine beyond smaller games, where the increase in performance (or decrease) would be minimal. I’ve searched the DevForum for answers with regards to my question, and besides one post (which I can no longer find) that discusses the best ways to optimize our games, no one else has mentioned anything relating to this type of optimization, to my knowledge. I know there was one user who mentioned transparent parts can decrease performance, although I don’t remember them elaborating on this, if it was semi-transparent parts (.5, for example) or fully transparent parts.

Apologies for the lengthy read, and apologies for any repetition.

4 Likes

Semi-transparent parts go through more rendering than usual which causes performance issues when used in great numbers. Transparent parts will not help your performance, if anything it will decrease it.

Fully transparent parts do not go through rendering. But, it does not help your game’s performance.
If you want to use fully transparent parts when you are blocking off certain areas of the map, or fixing hitbox issues, that is totally fine. Just know, this will not improve performance.

Overall, transparent parts will not improve your performance. But, the RenderFidelity of an object will. If you have complex shapes like unions or meshes and a semi-big map, I would recommend setting them to Automatic rather than precise. This will allow the game to adjust their level of detail based on the players field of view. There are also other methods to improve performance.


Edit: (@UltraBrickStudios )
Basic methods of improving performance for builders:

  • Set complex shape’s RenderFidelity to Automatic
    Command bar script:
for i,v in pairs(workspace:GetDescendants()) do
  if v:IsA("UnionOperation") or v:IsA("MeshPart") then
    v.RenderFidelity = "Automatic"
  end
end
  • Delete all un-needed welds, some beginners do not think of this. Welds will cause performance issues in big numbers.

  • If you have a big map, turn on StreamingEnabled and adjust the settings.

  • Use transparent and neon parts sparingly.

  • Use unions for what they are meant for (Don’t use them for grouping and organizing your parts. I see so many posts asking if unions are better at organizing than grouping. The answer is no, unions were never made for organizing objects)

  • Try to not use unions (Use blender or a different 3d modeling application that lets you control the object’s poly count)

  • Don’t download some random plugin that offer to do something scripting wise. Most front page plugins are viruses. Download plugins that are trusted, or have a programmer check the source of it.

Hope this helps.

16 Likes

The invisible part shouldn’t get rendered at all if transparency is fully set to 1 so you gain performance there, but you still pay for collisions. Disabling all types of collisions and querying on all the other parts should save on physics, but you still pay for the costs of rendering.

If these objects are moved and are welded to each other I believe there may be costs associated in maintaining correctness of those joints, but that’s where my knowledge on the engine internals get murky. I’d imagine there are other upkeep costs under the hood too, but I don’t think they’d be anywhere near an issue in the vast majority of cases.

You would pay if these objects end up in searches that your own code does though, like if you wanted to search through parts in a model and your algorithm happens to touch these objects.

In general the collider vs rendering object pattern is a pretty common and useful pattern, but it’s also reserved more for intricate visual models. You do get gains on less intricate objects like this, but nowhere near as much.

I’d personally recommend only optimizing your models like this as much as needed so you avoid making the game harder to maintain than it needs to be. Other than that, this is a perfectly fine method to improve performance.

Edit: Gonna add on to what Richard said about semi transparent objects: those need to be treated specially by the render pipeline because they aren’t fully compatible with optimizations that can be used on fully opaque objects. The names of the pipelines are forward and deferred if you are interested in looking them up, but the main idea is that with opaque objects you only need to light the opaque object closest to the camera, and you need to light every transparent object that is visible regardless of overlap.

8 Likes

I don’t know if what you’re doing is actually optimizing. Because you’re creating an invisible part solely for collisions when the other parts handle it just fine. Odds are you’re saving a negligible amount of performance.

I’d consider turning your object into a MeshPart and use the Box CollisionFidelity. That way you’ll be cutting down on memory usage and you won’t be clogging your game with invisible collision instances. This way you’ll also get to use RenderFidelity if your MeshPart is over 50 triangles.

There are plenty of really good responses on this topic, I suggest following all of their pointers.

1 Like

Do you mean, by changing my objects to union > MeshParts then setting Box CollisionFidelity along with Automatic on RenderFidelity? Would this process actually increase performance? I’m always looking for ways to improve performance for all users, even if it’s only marginal.