TriangleCount for all unions is 0 upon loading place

  • Describe the bug. Describe what is happening when the bug occurs. Describe what you would normally expect to occur.

When you first create a Union, you are able to retrieve its proper TriangleCount as expected during the Studio session you created it in.

However, upon saving, closing, and reloading that same place file, the TriangleCount of the union appears to be 0.

This is also the case if you publish the game online.

Old unions that have been in my game for years also appear to have a TriangleCount of 0.

  • How often does the bug happen (Everytime/sometimes/rarely)? What are the steps that reproduce the bug? Please list them in very high detail. Provide simple example places that exhibit the bug and provide description of what you believe should be the behavior.
  1. Create a new place
  2. Create a UnionOperation
  3. Save the place file
  4. Close the place
  5. Open the place again
  6. Print the TriangleCount of the union, it will be 0

This bug happens every time.

  • Where does the bug happen (www, gametest, etc) Is it level-specific? Is it game specific? Please post a link to the place that exhibits the issue.

This is happening in all places on production.

  • When did the bug start happening? If we can tie it to a specific release that helps us figure out what we broke.

I’m not sure when this started happening. I just found this out while trying to create a plugin that needs to read the TriangleCount of unions.

9 Likes

I noticed it around the 20th (I’m guessing) of Dec. when trying to make a fairly simple Union and looking at the triangle count to find it was 0. Not sure if it was before that or not since I didn’t look for it.

Dunno if it’s something to do with CSGv2?

1 Like

Hopefully this can be addressed soon, I need to be able to read the TriangleCount in order to help keep track of union usage while my game is being built.

It seems to be an issue with both CSGv1 and CSGv2 (I disabled CSGv2, made a new union, quit and reloaded the place, and the TriangleCount was still 0)

1 Like

It’s like the TriangleCount is only counted if you have seen the unions that make up that union(either by making it in this studio session or deunioning and reunioning). Knowing TriangleCount without any hacks was pretty useful.

@sircfenner made a plugin for reading how many triangles a Mesh takes up. It says it also works for Unions although I haven’t had the time to test it yet I don’t know if it too will just read 0.

This just reads the TriangleCount property if the selection is a Union, so won’t help you here I’m afraid.

I came across this bug as well while working on my incubator project and reported it internally, so it should be brought up to the appropriate parties soon. Don’t know when we’ll see a fix, but TriangleCount is an awesome feature, so hopefully it won’t be too long.

I wish an engineer or someone would acknowledge it publicly, this bug has been around for months now. The feature has been missed for a long time.

TriangleCount is a horrible feature. It worked using an obnoxious hack, and now some internal changes invalidated this hack and the feature stopped working.

We have two reasonable options:

  • Deprecate TriangleCount.
  • Change TriangleCount to a serialized property and teach CSG engine to save it when making a union (this is NOT how it works right now)
1 Like

In general, I imagine you’d find more developers who would prefer adding features than removing them. It’s less a question of which option is favorable to developers, and more so is there enough reason to continue supporting TriangleCount. What do you need from us to make that decision? More use cases? Numbers on how may developers use TriangleCount?

1 Like

I’d like to know why it’s important to know the triangle count of a union, given that there’s no information about triangle count of any other part type.

Problem is that not culling old and unfortunate features always impedes progress on features that are really needed/wanted by developers.

TriangleCount isn’t just useful for unions, but you never saw a feature request for BasePart since we could already hard-code the TriangleCount for primitive part types w/o waiting a month or few for an official feature. There was enough coverage with union-exclusive TriangleCount that developers were mostly satisfied. Some benefits of TriangleCount were exclusive to unions, though only a fraction.

Use case specific to unions:

Unions weren’t always so great with optimizing faces:

I’m not sure how much of an issue this is with CSGv2 and its lower triangle counts, but historically this allowed us to skip union operations entirely without having to wait ~10 seconds to be told the resulting union had too many triangles. Depending on how often developers will encounter the triangle limit with CSGv2, TriangleCount may no longer be needed for this.

All instances in general - level complexity:

If I look at the TriangleCount of instances in my level (actual TriangleCount or hard-coded), I can get a more granular understanding of my game’s memory usage than just knowing the total amount. Knowing my game uses 2 GB of video memory from unions is concerning but not very useful – knowing exactly which unions are responsible allows me to swiftly address the problem without recursively copying/pasting parts of my level into a new file to hunt down the responsible unions.

This is also a problem with meshes, and we have an open feature request (lost Thank Yous in switch to Discourse) in addition to two user workarounds <1>,<2>.

Assuming unions with too many triangles are no longer an issue with CSGv2, I just need some way to determine how complex a union is (or any mesh/BasePart/texture/sound/etc preferably). Having access to the file size of the instance we’re loading into memory would work too – it would be even more convenient actually, but is more specific to this use case than others.

Performance metrics seems like the primary use case though <1>, <2>, <3>, <4>, <5>, <6>, <7>, <8>, <9>, <10> – everything else was really minor – so maybe any potential features only need to address this use case.

4 Likes

A future release of CSGv2 later this year will remove the triangle count limit by automatically simplifying to the target limit, so that won’t be an issue.

The rest of this to me sounds like “we need better tools for understanding which instances take memory/performance” - I don’t think triangle count is a good tool for that (for one, memory impact can theoretically vary ~6x for same triangle count depending on the specific topology, and practically probably ~2x).

1 Like

Another use case is estimating how important it is to move a union over to a mesh. An example union in our game uses 200 to 600 triangles depending on how it’s built. I can send it to blender and make that number 68.

This issue still seems to occur even with CSG v3. I load up a place in studio, and all the union’s TriangleCount property are at 0. Even when play testing it’s still 0.

2 Likes

I am still getting zero, and for all unions rather than just ones that existed when I started the studio session.

1 Like