Hello Creators,
Hot off the heels of the recent in-experience Constructive Solid Geometry (CSG) GeometryService
API release, we’re excited to announce improvements to the performance and robustness of those APIs.
You don’t need to do anything special to enable these improvements. Continue using the APIs just as you are today and you should see the following improvements.
Please note that these improvements are currently only available in server scripts for published experience. We are currently rolling out these features for both local and server scripts in studio and they should become available in the next few hours. We will also enable local scripts support in published experiences in the next few weeks, once most clients are updated.
Improved Performance
Complex Shapes and Interactions
We’ve made several improvements to how our CSG engine handles complex shapes and interactions. For example, when two objects meet along a flat surface, or when they overlap significantly, our system now processes these intersections much faster. We ran a number of tests on internal benchmarks and we see improvements across the board. In some especially difficult cases with complex CSG geometry we recorded operations being orders of magnitude faster.
Improved “Cold Start” Performance
When performing CSG operations for the first time on complex objects, we previously had to re-evaluate the entire CSG tree before performing the operation. With the recent improvements, these “cold start” cases are now much faster. Take a look at the example below of doing a SubtractAsync
operation on this tank turret.
Faster Complex Tools
Performing CSG operations with simple tools on complex objects got a lot faster in our original release. Now, we’ve vastly improved the speed of CSG operations when using complex tools as well. In the example below, you can see a CSG “axe” being used to perform a subtract operation on the tree. The axe itself is a complex object that is made up of a number of CSG operations. With the new improvements, you can see how much faster the Subtract operation now runs.
Lower Memory Consumption
Using CSG has always been a delicate balance of complexity and memory use. The more complex the inputs of the CSG operation, the more memory was used. In some use cases, chained operations would use more and more memory. With the new improvements, memory usage is greatly reduced, especially in the case of chained operations. In the “axe” example above, memory usage would normally build over time as more and more CSG operations were performed. With the improved CSG engine (shown in red below), memory usage stays much more manageable as the number of operations grows.
Improved Robustness
Reduced CSG “Invalid Operation” Errors
One of the most common complaints when using CSG APIs was cryptic internal errors that would prevent the operation from completing successfully. We improved the reliability of the engine to vastly reduce the cases that could result in an invalid operation. This should allow you to be much more confident in leveraging the CSG system in your experiences. We are committed to stamping out every possible “invalid operation” error remaining so please drop us a note with an RBXL example if you do face one in the future.
Improved Normals For Better Lighting
Thanks to your feedback, we have also identified and resolved a long standing problem with the way CSG operations were handling normals. In the example below, you can see how the light hitting the walls created with CSG is much more realistic since the normals of the resulting operations are now fixed.
Sphere Alignment Between Studio and In-experience
Another issue we have heard loud and clear is with alignment issues. Previously, when using the sphere primitive with CSG in Studio, creations could look slightly different when the experience was eventually played at runtime. This was due to performance optimizations that were made to the sphere geometry to ensure CSG creations ran performantly in-experience. With the recent performance improvements, we can now use the exact same sphere geometry between Studio and in-experience to ensure your creations are faithfully recreated. In the example below, you can see how the seam between head and the droid created using CSG within Studio is not faithfully recreated currently but with the new improvements, it looks exactly the same.
Looking Ahead
We are introducing these improvements first in the recently announced GeometryService
CSG APIs but are working hard to also introduce these improvements to the CSG operations available within Studio and to Plugins. These will take a little longer since we want to make sure we do not break any existing workflows you might have.
We hope these improvements help you create much more complex and interesting CSG scenarios in your experiences, or at least enhance the robustness and stability of your existing experiences. As always, please let us know if you notice anything funky with these changes and we will do our best to fix them.
Thanks,
@pho01proof, @BelgianBikeGuy, @syntezoid and @FGmm_R2, on behalf of the entire Geometry team