APE - DeepMotion Avatar Physics Engine for Robust Joints and Powerful Motors

Joints to the Physics Engine are like Shaders to the Rendering Engine. They are the fundamental building blocks to construct advanced physics models for games including cars, tanks, robots, mechs, powered ragdolls, construction vehicles, monster trucks, heavy weight machinery, ropes, bridges, virtual creatures, …, etc. The default Unity physics engine, PhysX, unfortunately works very poorly with articulated multi-rigid body models consisted of multiple joints. The joints simulated by PhysX are springy and unstable under big mass ratio configuration. And it becomes even worse when the joints are powered by motors under huge torques. Things just go crazy when you stack too many joints in one model with PhysX. The lack of high fidelity articulated physics support often manifest as the following problems:

  • Two rigidly joined rigid bodies can be pulled apart under huge force
  • Mass ratio between two joined rigid bodies is limited to less than 1:10 in order to maintain joint stability
  • Heavy weight at the end of a long rope makes the rope springy, jumpy and unstable
  • Motors are soft and cannot deliver enough power to drive multi-level articulated robotics
  • Doors, hands, wheels wobble around their joint axis under heavy load
  • Simulation step size (time interval) has to be reduced to too small to provide the needed accuracy which kills the performance

I’m working on a brand new APE : Advanced Physics Engine for Robust Joints to solve all these problems from their root - robust joint simulation. Here are a few video clips of early prototype. Sorry for the poor rendering quality and rough edges in the models. I barely had any time polishing the demos yet.

  1. Motorized Arm - PhysX vs Articulated Physics

All the segments of the arms are assembled with actuated hinge (revolute) joints. The motor max force of the PhysX assembly is set to the maximum. The motor max force of the Articulated Physics assembly is set to 100. The mass ratio between the parts are proportional to their volumes. As we can see PhysX motors couldn’t output enough power and drive the multi joints arm stably while APE drove the motors smoothly with no problem. Under the disturbance of an external spring force exerted by the author interactively PhysX model behaves like a rubber band while APE holds the hinge joints rigidly even under extreme stress.

  1. Monster Truck - PhysX vs Articulated Physics

All the 3 monster trucks were modeled with identical topology. The right-most truck was simulated by articulated physics with mass ratio of 1: 15: 40 between struct, wheel and torso. The left-most truck was simulated by PhysX of Unity 4.5.2 with mass ratio 1: 15: 40 and it entirely collapsed to the ground even though the springs on the struts were configured to the maximum limit. The middle truck was simulated by PhysX with a reduced mass ratio at 1: 15: 1 to lessen the pressure on the joints at a cost of less torso stability. Also the hinge motors on the middle car were set to the maximum to propel truck onto the stairs. Even so it crawled extremely slow and couldn’t climb up the stairs. The right-most truck simulated by Articulated Physics engine climbed up and down the stairs at ease. There was zero joint wobbling and the motors output tremendous amount of torque with great stability.

  1. Monster Truck Prototype - Articulated Physics

It is a monster truck chassis prototype of 4 independent suspension structs, decoupled front-wheel steering and 4WD. This is realtime physics simulation of the actual rubber-on-the-ground wheel collision, mechanical suspension and steering. No ray-casting, key-frame animation or special force accumulation scripts were used. Compared to the canned typical raycast vehicle model (aka wheel collider) this simple model simulate the real physics of the interaction of monster truck suspension, wheels and the complex terrain. It’s very hard if not impossible to fake such interaction with a single rigid body plus 4 ray-cast “wheels”.

  1. Articulated Spider
    Besides mechanical machines APE can model and simulate articulated creatures too. The following is a quick demo of an articulated spider simulated by APE.

The spider has 8 ball socket joints at its shoulders and 8 hinge joints at its knees and 2 ball joints at its eye balls and 1 ball joint between the butt and the torso. All together it has 8 * 3 + 8 + 2 + 1 = 35 DOF (degree of freedom). The 24 DOF at the shoulders and knees are powered by APE velocity controlled position motors.

The simulation was fully dynamics and done in Unity editor in real-time. No key frame animations or kinematic motion. Occasionally I dragged the spider around with a dynamic spring force applied between the spider and the mouse cursor to spice things up a little bit.

Currently only a trivial 4-phase walk controller was implemented in C#. We can easily extend the script to teach the spider more gaits such as jump and turn. The topology of the spider needs some work too to balance the butt with the torso better and reduce the yaw during walk. What’s cool about APE editor is that you can generate the physics based motion controller using ID (Inverse Dynamics).

  1. Multi-Rope Crane
    This multi-rope crane model is very challenging to simulate because :
  1. There are five ropes in the mechanism that form 4 loops in the topology which means error accumulation can go extremely fast if a tiny inaccuracy in the joints surfaces.
  2. The cargo box is extremely heavy compared to the rope. The mass ratio between the cargo box and a rope segment is 500:1.
  3. This is a heavily articulated mechanism. The ropes are simulated with 64 rigid bodies in capsule shapes interconnected with 64 ball joints.
    It was said it’s impossible to simulate such mechanism with the built-in physics engine.

What do you think ? What’s your experience modeling challenging articulated multi-body mechanisms with the default PhysX engine ? Will APE be of interest to you ?

Thanks
A. P.

6 Likes

Could not this explain some of the issues you have with the built-in physic engine ? Mass is not supposed to be set to this kind of values ^^

Seems nice anyway, good luck !

1 Like

Looks good! I think it’s very interesting and would be handy in many situations. I would consider using something like this if it’s performance is equal to or better than PhysX, and if it can physically cooperate with PhysX.

Regardless, I would still like to know how you’ve implemented this. :slight_smile:

Hi Sven

Thank you for the link which is the official guide line to advise against mass ratio smaller than 0.1 or larger than 10 because otherwise it makes the default physics engine unstable.

This is the exact limitation I’m trying to break. When you model real world mechanisms you don’t have a constraint of mass ratio and you actually have no control on the mass in an object. In games, yes, we can fake the mass to be 1.0 everywhere to make the engine happier but that means unrealistic simulation and it can look bad. I will post a simple video to demonstrate this point later.

A.P.

1 Like

The demo videos were made with PhysX and Articulated Physics running in the same scene. So yes, they can co-exist. You can even make the same object simulated by both engines if you mark it as “kinematic” in one engine and “dynamic” in the other. You don’t want
to simulated the same object as dynamic rigid body because they will fight to change its transform by definition.

The engine is written in native C++ code and optimized for mobile performance. For articulated multi-body simulation it will out perform the default engine and deliver the joint accuracy that the latter cannot. For huge pile of boxes scenes it will run at the similar speed as the built in engine because it’s not optimized for that. If all your need is to drop a huge pile of single rigid bodies on the floor with no joints to constrain the body-body motion you don’t need Articulated Physics.

Joints to physics engine are like shaders to graphics engine. IMO it’s the joints that bring life to an other wise boring discrete rigid body world.

Nice, can this be used to correlate mass ratio to realworld measurements?

Thanks for the response. It’s clear that both systems can exist the in the same scene. I’m curious if an Articulated Physics object can interact (collide and apply force) to default rigidbody, and vice versa. And if, for instance, you metered the computational load (performance) of each of the motorized arms in your second demonstration, which system would perform faster?

You bet! You can pick a unit system, for example, meter/kilogram/second, and feed in real-world measurement data to your physical models built with the articulated physics engine and see how it simulates it out. The problem of hacking mass of all parts in the virtual model to be 1.0 or similar scale is that their center of mass and moment of inertia will be fake and unrealistic which can look weird sometime. For example you may feel that vehicles in game are floaty and not turn and suspend with enough weight on it.

2 Likes

It’s unclear to me whether you asked the CPU load of the default physics simulation vs the articulated physics simulation or the amount of torque exerted at the joints by both physical engines. Assuming it’s the latter here is more details:

For the “motorized arm” demo the mechanisms simulated by both engines are setup with the exactly same masses and joint coordinates. The maximum motor force set into the PhysX simulated model is 1e+20. Apparently PhysX internally capped the max torque and it has no effect once you set the max motor force to something higher than 1e+5 or so. I think the reason of the internal cap of maximum motor force by PhysX is to ensure simulation stability cause it’s more challenging to stabilize an articulated system under the stress of larger forces/torques. The maximum motor force set to the ArticulatedPhysics model is only 1000 and as you can see it’s enough to drive the arm stably. There is still a big header room to the max torque of the articulated physics mechanism which means you can make the arm much longer and still expect the Articulated Physics engine to exert enough power to drive the load without crazy wobbling.

A new demo video of a simple monster truck articulated physics model simulated with Articulated Physics Engine. Sorry for the blank textures and rough models. I sketched it in a couple of hours just to test basic prismatic suspension joints and steering motors of the Articulated Physics Engine.

It is a monster truck chassis prototype of 4 independent suspension struts, decoupled front-wheel steering and 4WD. This is realtime physics simulation of the actual rubber-on-the-ground wheel collision, mechanical suspension and steering. No ray-casting, key-frame animation or special force accumulation scripts were used. Compared to the canned typical raycast vehicle model (aka wheel collider) this simple model simulate the real physics of the interaction of monster truck suspension, wheels and the complex terrain. It’s very hard if not impossible to fake such interaction with a single rigid body plus 4 ray-cast “wheels”.

1 Like

Impressive. Any estimate on release?

No estimate yet. Definitely will use it in some games.

A new demo video comparing the monster truck articulated model simulated by PhysX vs Articulated Physics:

All the 3 monster trucks were modeled with identical topology. The right-most truck was simulated by articulated physics with mass ratio of 1: 15: 40 between struct, wheel and torso. The left-most truck was simulated by PhysX of Unity 4.5.2 with mass ratio 1: 15: 40 and it entirely collapsed to the ground even though the springs on the struts were configured to the maximum limit. The middle truck was simulated by PhysX with a reduced mass ratio at 1: 15: 1 to lessen the pressure on the joints at a cost of less torso stability. Also the hinge motors on the middle car were set to the maximum to propel truck onto the stairs. Even so it crawled extremely slow and couldn’t climb up the stairs. The right-most truck simulated by Articulated Physics engine climbed up and down the stairs at ease. There was zero joint wobbling and the motors output tremendous amount of torque with great stability.

1 Like

Why not a web demo? Not like these are shaders or anything. :slight_smile:

Hey, I’m interested to use it on a Crane Game. Do you think it will be possible?

More than possible since Crane is a like a nickname of an articulated physical machine :slight_smile: Are there particular simulation challenges in the crane model you envisioned ? Did you try the built-in physics already and find it insufficient in your use case ? I think it will be challenging to build a long crane arm with multi level of joints (both revolute and prismatic) enduring huge torques with the built-in physics engine. I should probably build a crane model to validate that.

I want to create this kind of thing, with another cables on the cargo. Take a look on the picture. I tried with the built-in physics without success. Please tell me if this is possible ( I hope yes ).

Sounds a good idea. Will give it a try.

Hi Emergki,

Here is a video of the multi-rope crane model you described simulated by Articulated Physics Engine captured in realtime.

https://www.youtube.com/watch?v=wYnHgHlqDSM

This mechanism is very challenging to simulate because:

  1. There are five ropes in the mechanism that form four loops in the topology which means error accumulation can go extremely fast if a tiny inaccuracy in the joints surfaces.
  2. The cargo box is extremely heavy compared to the rope. The mass ratio between the cargo box and a rope segment is 500:1. I was told such
  3. This is a heavily articulated mechanism. The ropes are simulated with 64 rigid bodies in capsule shapes interconnected with 64 ball joints.

Have fun,
A.P.

1 Like

Hey my friend, thank you for the video and your work on this.
I have some another questions:

The middle cable just needs to be conected to the another 4 cables, not with the cargo box, this is possible or not?
Do you think that is possible to make the rope more “firm”?
Is possible to increase/decrease the size of the rope?