Obi 3 and Obi Cloth 3 for Unity: News
Obi Cloth 3.0 has been released and we wanted to give you a heads up on what’s new, what’s changed and why it took so long.
This new version has been almost completely rewritten from scratch, just as version 2.0 was. Because of this, it is not backwards compatible with 2.x, so if you are using 2.x version you´ll have to re-initialize your cloth objects. Our development efforts have been focused on performance, usability and versatility.
3.x is between 3 and 4 times faster than 2.x was, and almost as fast as PhysX while delivering much higher quality simulation. Here’s the numbers:
Obi 3.x uses an all new task-based thread scheduler that makes the most out of your CPU cores. Cloth pieces are grouped (or split) in several similarly-sized chunks, that are then dispatched to the appropriate thread for processing, which results in better workload balancing. Critical math-intensive sections now use optimized SIMD code when possible.
Mesh updating for both skinned and regular meshes has been moved from C# to Obi’s C++ insides, which results in a huge performance increase. Overall memory allocation has also been reduced. From around 200kbs allocated each frame for a mid-sized scene, we went down to 160 bytes for the same scene.
Memory is pre-allocated when possible. For instance, tearable cloth pre-allocates memory to allow a user-defined percentage of destructibility. This results in faster tear updates and a fixed memory footprint for each cloth object.
If this all sounds like mumbo jumbo to you, just try it and see the difference for yourself :).
A custom runtime profiler has been added, so you can see what’s eating up performance and act accordingly. While not an essential addition at first sight, we feel it provides invaluable information for advanced users. In the following screenshot you can see how it looks: time runs from left to right, and each row represents work done by a separate thread.
The particle editor has been re-designed for compactness and better tool layout. Tools are now color-coded according to their use, and tooltips offer additional info for each one:
While in edit mode, particles are rendered over a flat-shaded version of the cloth mesh, which results in less visual clutter. Also, when painting per-vertex properties, particles disappear and color ramp is rendered for better feedback about the property you’re painting:
Keeping the MeshRenderer mesh and the topology mesh in sync is no longer the user’s responsibility. When you initialize a cloth object, the rendered mesh is automatically grabbed from the topology. This makes the set up process faster and easier.
When using an animated SkinnedMeshRenderer as the source for your cloth, there’s no longer any need to manually set the Animator component’s update mode to “Update Physics”. The animator update cycle is completely managed by Obi, and updated when needed.
A new helper component has been added, that allows you to perform cloth mouse-picking using raycasts. This is a common use case that was overlooked in 2.x, but we got you covered in 3.x. Just drop ObiClothDragger into a cloth object, and you’re ready to go:
Pin constraints are breakable, and the breaking threshold is configurable per-constraint:
Proxies now work with skinned meshes. This enables a wider range of character clothing effects, including (but not limited to) thick meshes with belts, pockets, disconnected geometry, etc. If you’re new to proxies, they’re a nifty feature that allow you to drive a high-res mesh using a low-res simulation.
A new proxy binding editor has been integrated to allow you to paint mesh influences directly inside unity, and control how the target mesh binds to the simulation mesh. For simple use-cases where the whole mesh binds directly to the simulation, Obi will automatically set it up for you at the press of a button.
Tear resistance is now paintable per-particle. This allows you to define the shape in which a cloth piece will tear, which can be used for a lot of cool effects:
Per-particle skin stiffness is also a paintable property now, which is great for wobbly flesh:
In 3.0 wind works using a zone based system. You can provide an ambient wind direction and intensity, and add spherical sources of directional/radial wind. Parenting a wind source to some rotating blades can be useful to make a fan:
And last, we have updated our core constraint solver to XPBD. XPBD is a recent technique that improves upon position-based dynamics, decoupling constraint stiffness from iteration count and time-step size. It also reduces artificial damping. This means more accurate simulation, and easier to tune constraint parameters. In regular PBD, you set a material stiffness value but the actual result will vary wildly depending on the amount of solver iterations and your physics timestep. This makes tuning material parameters a nightmare when deploying on multiple platforms with different performance budgets. XPBD is guaranteed to converge to the same result given the same stiffness parameter and enough iterations, which makes your life so much easier.
As an added bonus, XPBD also provides accurate force estimates for constraints, which come in handy for things like tearable cloth. Take a look at this video by the developers of the technique for a more in-depth comparison of PBD, XPBD and a reference Newton solver:
Why it took so long?
There are several reasons why this release has been a though one:
- The sheer magnitude of the update. Designing, changing and testing so many things is a time-consuming process.
- We are setting up a system for bug reporting, suggestions and user feedback. We want to create a community of users who can suggest and vote new ideas, make sure it’s clear where to go when you need advice or support, and create a growing database of use-case oriented recipes. We’ve been receiving lots of emails containing similar question and ideas regarding Obi 2.x, and we feel it would be beneficial for everybody if all this knowledge could be shared.
- We want to fight piracy to a reasonable extent. To do so we are implementing a client verification system. We do try to offer support for everybody, but expending time and resources on helping rogue users feels unfair to those who have paid for it.
- We have to create new videos to showcase new features, and documentation to make sure you know how to achieve what you need from Obi.
- Making sure that future updates on version 3 will be backwards compatible with all 3.X versions. Designing data layout to ensure no serialization issues arise later down the road is far from trivial.
- Bugfixing, compiling and testing the library in all supported platforms (Windows, OS X, iOS and Android), then polishing performance in each one.
As end users, we know how frustrating it is to have an otherwise perfectly fine piece of software that lacks a small feature that is absolutely essential to your project, one that is not easy (or even possible) to add yourself. That’s why we put so much effort in this release, and we sincerely hope it lives up to your expectations.
The VM team