YL2 - Soft bodies part 2
Last month, we showed off experimental work on a custom soft body physics engine. While the results were interesting and fun, we couldn't find a way to make this tech work for our specific purposes. Having poured so much effort and energy into the pursuit of achieving soft bodies in YL2, we didn't want to give up just yet. This month have been exploring other ways to implement soft bodies. We are happy to say we now have a feasible method.
Previous tech addendum
Before we jump into our new method, we want to share some research we made regarding the other one.
In our previous post, we mentioned the challenge of combining soft body physics with animated characters. After doing some more experimentation, we have discovered a method that works to mitigate undesirable behaviour on a skinned soft body character.
Here's an example showing the difference.
The way this mitigation tech works is by disregarding any movement and rotation that occurred outside of the simulation, which does make it much more stable. Unfortunately, this also means swinging motion that you'd expect from said movement is also lost:
(Despite moving the character around, the belly and tits don't swing in the way you'd expect.)
It seems that when you solve one thing, another thing is taken away.
With the mitigation tech shown above, we'd essentially limit the soft body tech to only interact with colliders. Swinging motion for belly, asses and tits would have to be implemented elsewhere. Perhaps this tech could be combined with regular jiggle bones. However, even if that's the case (and that would also require much more experimentation), there are many other challenges, especially in the performance and stability areas. While we are happy we invested time into exploring this tech, we feel more confidence in taking another approach for now.
Our new tech isn't really new. Rather, it is an expansion on our "fake" method described in our previous post. I.e., rather than actually simulating soft bodies, we "fake" the deformation using a simple algorithm and shader tricks. While the method is completely bogus from a scientific point of view, the results are quite appealing and the benefits to our previous method are many. For starters, this technique works completely independently of frames and animation. I.e., it is stateless and simply acts more as a post processing step on skinned vertex buffers. This makes its behaviour very predictable and comparatively stable. Furthermore, what would take several hundreds of gpu compute invocations to achieve in our older method, can be achieved using just single digit invocations in our new one. This makes it much more performant, as in an order of magnitude. With our previous method, we feared we'd have to limit characters to 2 per scene, but with our new one, we can have a full 8 characters and still render at plus 500 frames on modern systems.
While we do think "real" soft bodies is the future, perhaps this "fake" method can act as a migratory step towards it. Then, in the future when hardware is more powerful, soft bodies will become more feasible to do in realtime in scenarios such as ours. Hopefully, 3rd party libraries will have evolved more by then too. Because while we do love getting our hands dirty exploring these technologies ourselves, it's inevitable that any soft body engine we'd make would eventually never be able to keep up with the thousands of not millions of man hours put into 3rd party libraries. So maybe a simpler library that's more performant and easier to maintain (new tech) is the way to go for now?
Adapting this new technology from working solely on simple objects to working on fully rigged characters has been a huge challenge. While the idea behind the tech is at its core the same, everything around it has been completely re-imagined and reworked beyond recognition to its original implementation. We use many more steps and advanced techniques to achieve the results below. It is with great pleasure we are sharing them with you!
In all examples below, characters are missing drivers for chest. This means the tech that handles this issue is not active. We are happy to say that our soft body tech works regardless of what deformation stack has been applied before it, so it will be compatible with drivers. We simply haven't gotten to implementing them into YL2 yet. Keep that in mind when looking at the images below. Drivers will be implemented eventually.
We will go through each example here in the same order as we implemented them.
We started with simple spheres, as that is the most simple form of collision. As with our previous method, we use a mirroring script to apply the collision on both sides simultaneously.
(Applying sphere collision on both sides of the ass.)
(Another view while applying sphere collision on ass.)
(And a third view, applying the same collision.)
Next up was collision against planes.
(Plane collision against ass.)
This tech was designed with inflation in mind from scratch, so of course it works with that too. From the techs point of view, it makes no difference what deformation stack has been applied before this effect. It solely acts as a post processing filter on the vertex buffers.
(Belly inflation being applied while obstacle is in the way.)
(Moving collider to influence belly and tits.)
(Inflating titties while obstacle is in the way.)
You might have noticed that the belly was slightly affected as the titties were inflated. Let's have a closer look at that without any obstacles.
(Inflated parts react to eachother.)
(Jiggling boobs affect belly.)
(Strongly jiggling boobs against eachother in slow motion. Belly is affected as well.)
(Older iteration but thought I'd include anyway. Jiggling boobs against eachother in slow motion. Note that all this is just jiggle bones, and soft bodies are applied as a post processing step to skinning.)
(For comparison - here's what the deformation would look like using solely skinning (no soft bodies)).
(For comparison - here's what it would look like using rigid body collision instead of soft bodies.)
This tech works on soft bodies intersecting with eachother too. It was challenging, but we made it.
(Inflated bellies of two separate bodies reacting to eachother.)
(Inflating boobs of two separate bodies reacting to eachother.)
(Moving 1 body to examine soft body vs soft body collision response.)
Note that all of this is completely fake. Since the algorithm has no concept of intersecting surfaces, we had to fake friction between them.
Of course this tech works between asses being pressed against eachother as well.
(Asses being pressed together.)
(Examining ass collision response from different angles.)
(Ass collision response from side.)
(Ass collision from side when facing the same direction.)
None of these results are necessarily perfect, but given the flexibility and performance of the tech, I'd say we're pretty happy with it!
Right now, this tech only works on spherical shapes. By that I don't necessarily mean we use proxies, but rather that the actual algorithm itself operates on a reference point in space and on a radius. These points and radii can of course be fed into the algorithm using "live" data rather than proxies, but acquiring this live data is only performant to do on spherical shapes. For tits and bellies this isn't a huge issue, as they can be considered spheres. Neither is it a problem for asses. However, the thighs are problematic, because they're elongated shapes. We did try to come up with tech to handle this in a performant fashion, but so far have been unsuccessful in achieving something satisfactory. The solutions we managed to produce would indeed make the thighs deform in desired ways, but at the cost of making the ass deformation look worse. While we think thighs are important, we think asses are even more important, so for now we have prioritized asses over thighs. There is currently no deformation on thighs other than the ass affecting thigh when being deformed. This isn't necessarily a big problem as long as authors are aware of it and can work around this limitation when setting up interactions.
Also, again - this tech is solely a post processing filter on the vertex buffers. It doesn't affect environment, and it isn't physically realistic. It only works on environment -> soft body, or soft body -> soft body.
I must admit I feel a little bit guilty, having spent these two months doing something else than working on the character creator. After the crunch, I just felt I needed some time off and do something different for a while. We all have our indulgences, and exploring new technology is mine.
When we missed the 2018 mark for a release of YL2, it actually took me harder than I've been letting on. I felt quite depressed and disappointed in myself. I think working on these soft body technologies has been a way for me to cope, just to get my mind off things and do something different.
When looking back at all the effort we've put into YL2, I realize now that this missed mark doesn't have so much to do with lack of work or engagement, but more about just having misjudged the amount of work required to get where we want. That isn't necessarily a bad thing - it just means we are ambitious... and suck at predicting dates LOL.
With all this tech explored and implemented, I finally feel ready to start working on the character editor again. While this little journey may have delayed the character editor a bit, I don't regret for a moment having invested this time into it. With this tech in our bag, it feels like we have something truly amazing that will greatly set us apart from other projects.
Let's wrap this up and get a release out there!
After much hard work and experimentation, we believe we finally have a feasible method for doing soft bodies in YL2. The tech is hardly perfect, but it is very performant and flexible, and the results are fun and appealing - much more so than not having the tech!
After having taken this journey of exploring soft bodies, we feel ready to work on the character editor again.