Animation/interactions progress part 2 (Patreon)
Content
Hi all!
Work on the new interaction and animation systems continues, and this past month we've been very busy working on simulation of shafts as well as a new LookIK system. Built using our new custom made physics framework, we have managed to create something we believe to be the most advanced shaft simulation system in any real time application (at least to the best of our knowledge).
Read on for the full details!
LookIK
Starting with the less naughty bits.
As you may know, we're in the process of implementing our own IK (inverse kinematics) system, built on our own custom made physics engine. This approach has many benefits, which is something we've covered before.
Naturally, a system for controlling the characters' gaze is something that needs to exist, and that's what we've spent time implementing this past month.
Our solution works on multiple neck setups. The characters will act naturally for that setup:
https://gyazo.com/846ccdf0f0fc545ed98abeb9c57d6156
https://gyazo.com/6fef1f921c2203e85de022865c2623d5
https://gyazo.com/3f8626b5021d391e12bcea9d3ec439e8
https://gyazo.com/cece65cea432e61cbeae6e64e94c54ae
(Neck and head adapt to look in the direction of the IK target.)
(NOTE! The movement of the eyes has not been implemented yet, since the eyes aren't physical (simply a transform).)
Note that this is not a system operating on transforms. It's actually doing the physical calculations to move the entities that make up the physical representation of the neck and head, which in turn will affect the transforms (not the other way around). What's the point of this? Well, the whole point of our system is that it blends animation, IK and physics in one single system. So rather than using several different systems, we have a single one in which all the computations happen. This means implementation and consistency becomes much easier, and you'd be able to set up a greater variety of interactions without separate systems breaking down or interfering with eachother.
Imagine, for example, that a character (A) has parented a hand to the head of another character (B), and that (B) is moving its head in order to look in a certain direction. This dynamic will solve itself naturally and physical equilibrium will be reached. This LookIK system is essentially just a bunch of constraints that operate within the same framework. So the head of (B) won't be able to turn more than the arm of (A) is able to stretch, for example. At least, that's the idea (we haven't gotten that far yet to have multiple character interaction, but this is what we're trying to accomplish among many other things with these custom systems).
Shaft simulation
As I perhaps boldly stated in the opening paragraph - I believe we've managed to implement the most advanced shaft simulation system of any real time app.
Animated shafts is something you see quite often, but their implementations are often very specific (limited). While the may excel in one area, they lack in others. Rigs may be impressive and have all sorts of features built into them, but they require a skilled animator to actually make full use of, and they aren't truly physical or interactive. Others may have physical features, but only to an extent (usually only in the shafts' fully erected forms). Or, sometimes you see a shaft simply morphing between two targets, and that's all there is to it.
Built using our own custom physics framework, we've manged to create a system that is truly physical throughout the whole process - not only able to simulate flaccidness and erection in a physical and interactive manner, but also actual, physical growth as well as emergence from body. At no point during this whole process is it in a pre-animated state - it's always physical and interactive.
The body is also simulated, properly adapting the sheath to the shape of the shaft.
The way we have implemented our shaft technology is through the distinct implementing of 4 different features that are all able to operate simultaneously. Making all of these things work together has been challenging.
Let's take a look at each one of these systems in separate before seeing them all come together in an appetizing display.
Growth
This is in a way perhaps the easiest system to understand.
Growth is simply an interpolation between two states of the shaft. These two states can be configured manually. The erected state is what you're already familiar with in the shaft options object. What's new, however, is the unerected state, which has it's own object that you can configure. It's located underneath the shaft options object:
Simply configure what you want the shaft to look like when erected and when unerected, and you'll have your two states for this growth feature to function.
The way the growth is applied is simply through a slider, which is located in the physical character object.
(Growth with zero erection.)
https://gyazo.com/41ca34aa2b939627ce7917ac34b388cb
(Growth with full erection.)
https://gyazo.com/7b2d65eb33f9173ff831ff71a13db0fd
Erection
The erection slider forces the constraints to align according to the configured shape (in shaft options).
https://gyazo.com/73cdd956d8d33a50260b6291c1dfee30
Emergence
Emergence was by far the most tricky system to implement, especially with how it's supposed to operate with the other systems.
(Emergence with smallest growth.)
https://gyazo.com/f8e391c0e49ccf6ebdb333ef84d53ccf
(Emergence with full growth.)
https://gyazo.com/3533181cd00842b66b554af237e18b68
I might point out that emergence is compatible with ANY configuration of the other sliders, meaning you can animate both growth and emergence, for example.
(Close up of the body adaptation tech.)
https://gyazo.com/fe7557fe32ccb8b65a68185ae65f234f
All together
https://gyazo.com/00a12d5624ab86ca20b3d8c7fd01afbc
As I explained earlier, throughout this whole process, the shaft is fully dynamic and interactive. There's no pre-animated state.
(The shaft is always fully dynamic. No cheating. No pre-animation.)
https://gyazo.com/6d480e154bca7f5946fca2d9a819bc47
What allows us to blend these properties and constraints so seamlessly is our own physics framework. We can interpolate not only the properties of joints, but also their anchors, their orientations as well as their influences (as in blend it back to before constraint was applied according to a value). Without these features, it wouldn't be possible to achieve this.
(A view of what's happening internally. Anchors, properties and influences are blended seamlessly.)
https://gyazo.com/0b349fa0de86c44e26559f8c02711970
Collision bridge system
We have implemented a system that acts as a bridge between our physics engine and unity. This is great, because it means that the environment artist can work as usual and use regular unity colliders. Our system will properly consider these colliders when doing collision checks. Furthermore, friction is also computed.
(Our system can collide with unity colliders. No extra setup needed on behalf of the environment artist.)
https://gyazo.com/e08d8375b63f3366549f95e926b28fc8
Thrusting the wall will make the shaft bend and adapt, as expected. I can imagine some interesting scenes here with windows!
Please note that the collider sizes of shaft haven't been configured and it's very much WIP.
https://gyazo.com/4d71eb04d3cd9e7551e4fe8a37dd4a0c
Constraint
A great benefit of implementing our own physics engine means we have full control of everything that goes on in it at all times. This has allowed us to play with the idea of a "shaft slider".
The shaft slider is a custom constraint that acts as tunnel for shafts to slide into. It's still very much a thing we're just testing with, but initial tests are looking promising.
Rather than relying on intricate setups with colliders configured in a complex fashion to try and give the physical behavior of a tunnel, we simply have this one constraint that we have coded to simulate the tunnel.
The shaft will be attracted to stay within the tunnel, and will bend and turn in order to fit into it.
None of that is animated, it simply happens as a consequence of the constraints doing their work.
https://gyazo.com/51fc62609140a7561d26fe9561044d2d
https://gyazo.com/656b6ef6a397df2d15c410bf5175d6cc
https://gyazo.com/4c3e344a0d209fecb8a4a1d1cb3a9cf8
https://gyazo.com/ba4c54ac822dbab693400d7b68a51489
https://gyazo.com/57f89ef1f7f5e9228aa542a9905485cd
As this system is based on physical calculations rather pre-animation, it means that if we move the body in such a way that the shaft can't stay within the tunnel, it will plop out of the constraint. The sudden released energy will give it a characteristic spring behavior. I think this could come in very handy for pull out scenes! All fully dynamic!
https://gyazo.com/de2ceafb0528de5f21bac27cebcaa5f6
Imagine certain white liquid gushing out from tunnel as well as shaft in the above image. I think it could become very engaging!
(Another angle.)
https://gyazo.com/793c4e7292b502cf0c1a8c549ba245bd
Summary
Work on animation systems is progressing. This month we implemented shaft dynamics as well as a look IK system. Things are looking promising and we couldn't be more excited!
Enjoy your weekend!
All the best.
- odes
P.S.
Special thanks to The GERio for allowing us to use his character!