Sep 24, 2022

2016, The Jiggle Begins

Bio and I had stumbled upon the Shape Matching research paper after weeks of aimless searching, and were racing to realize it in code, skyping back and forth furiously. We couldn't pull off their "least squares rotation matching" algorithm without a mathematically complex "inverse square root" matrix operation, so we were trying to ad hoc it instead. How hard could it be to figure out an object's rotation?
Bio's "torque minimizing" approach in matlab, inspired by their in-progress engineering degree.

Some hairbrained scheme of mine


Back and forth, crazy idea after crazy idea, twitchy messes of cubes... I think Bio was giving up hope and saying we should just do it the right way, when behold! A janky ass method of determining a cube's rotation, using tons of cross products to exploit all the orthogonal lines!    

Of course, it would never work for anything not cube shaped (despite my best efforts), but it worked! And all those silly CS papers just used their jiggly cubes as deformation meshes anyways, so who needs fancy smooth jiggle meshes!
(Spoilers, we needed fancy smooth jiggle meshes. 'Turns out cube based deformation meshes are... Just a pain.)

And so, with my (usually) flawless rotation matching algorithm that could handle any (cube shaped) object you threw at it, I bravely ignored Bio's pleas for a more sensible solution and plowed ahead!

Uh oh... 8 frames per second with only 1000 cubes... Well we're going to need a lot more than that for good T&A...

Not to worry! Some of those papers mentioned that the GPU runs hundreds of times faster than the CPU, so I'll just port it over! Of course, I don't actually know anything about GPU coding... So I'll just use UE4 material blueprints for physics logic!

Oh boy...

While the idea is technically possible, visual scripting isn't meant for anything nearly this complex. Enter months and months of debugging hell.


Oh I did get the basics working... And as hoped, it ran hundreds- maybe thousands- of times faster than the CPU version, as I excitedly declared victory on twitter over and over.




Unfortunately, there's a huge gulf between a set of jiggly cubes and an animated character, and after 3 months of visual scripting hell I'd decided enough was enough.

Goodbye never ending, impossible to find glitches. I'm done.

And since Unreal Engine 4 didn't (and still doesn't, to my knowledge) have dev friendly support for complex shader code, I was also done with UE4. 

The thought of having to start over in a new language and a new game engine (Unity) that I had moved on from years ago was... Demoralizing, to say the least. And I knew deep down that I should really be doing the math the right way. Using the paper sanctioned rotation matching method that could handle arbitrary, rounded meshes. It was all going to be a lot of work...

...So I put it off. That was it for jiggle, for just over 2 years.

No comments:

Post a Comment

2016, The Jiggle Begins

Bio and I had stumbled upon the Shape Matching research paper after weeks of aimless searching, and were racing to realize it in code, skyp...