Minie v6.0 physics library

Version 6.0.0 of the Minie physics library was released today. It fixes a couple bugs and adds an alternative version of the V-HACD algorithm for mesh decomposition. An app for tuning V-HACD to specific meshes has been added. Minie v6 also marks the end of support for certain old Linux distros (such as Centos 7 and Ubuntu Xenial 16.04) that lack modern shared libraries.

V-HACD is used to decompose arbitrary meshes into convex shapes that permit efficient physics simulation. Minie v0.9.13 added support for Khaled Mamou’s “classic” V-HACD algorithm using Riccardo’s Java bindings. Since Minie v1.4, the algorithm has been an integral feature of Minie, built into its native libraries.

Meanwhile, the V-HACD project has continued to evolve. In June 2020, I evaluated the “performance-improvements” branch of the project repo and found it unsatisfactory. Then, three weeks ago, John Ratcliff (who appears to be V-HACD’s current maintainer) announced V-HACD v4, a major rewrite. Since then, I’ve compared v4 to the classic algorithm. They really are very different. Each version has pluses and minuses, so I decided Minie should include both.

In order to use V-HACD effectively, it should be tuned to each specific input mesh. To aid my investigations, I created VhacdTuner, an open-source JME application for manually tuning V-HACD. The app makes it easier to compare the 2 algorithms on a specific mesh. I think it’s fairly self-explanatory. However, I will create a demo video and post it here soon.

Meanwhile, Ratcliff has published a slideshow/video presentation that explains the tuning parameters of V-HACD version 4:

Minie v6.0.0 also addresses a serious bug that v5.1.0 introduced into DynamicAnimControl. For details, see issue 30.

In order to compile V-HACD version 4, I had to upgrade the Linux compilers from GCC v4/v5 to GCC v6/v7. That change means Minie is no longer compatible with some old Linux distros. Unless you need to run on such systems, I recommend upgrading to Minie v6.

13 Likes

Awesome! I’m eager to try it. A few questions about the new V-HACD:

Can I run VhacdTuner from one of those jars? Or I need to build from source?
The performance differences are only in the mesh generation or also the physics simulation?
Does it support multi threading (I saw it in the presentation)? and how to configure that?

Thanks!

1 Like

Can I run VhacdTuner from one of those jars? Or I need to build from source?

You need to build from source.

The performance differences are only in the mesh generation or also the physics simulation?

Both.

Does it support multi threading (I saw it in the presentation)? and how to configure that?

V-HACD v4 uses an “async” flag during decomposition. When enabled, it creates only a single thread, so there’s no speedup. The “async” option enables an app to perform other tasks while waiting for a long decomposition to complete. It could also be used to run multiple decompositions in parallel.

Minie’s Java API exposes the “async” flag, but not in a useful way. However, Java has excellent thread support; if you need to run V-HACD in the background, I recommend using Java threads instead!

I was asking because in the first video (timestamp 5:20 he types “-a false”) of the presentation they show the difference between enabling and disabling a parallel flag for a single decomposition and they get a speed improvement.

1 Like

I’ll take another look.

Edit: From reading the C++ source code, I’d convinced myself that the decomposition work is not parallelized over multiple threads. In the video, however, Ratcliff clearly states that portions of the algorithm are parallelized across multiple threads for speedup. I’ve now verified a 2x speedup using VhacdTuner, so I no longer doubt his claim. Sorry for the confusion!

When running V-HACD v4 from Minie, the “async” option is enabled by default. If desired, you can disable it using Vhacd4Parameters.setAsync(false). I’ve added a button to the “test” screen of VhacdTuner that toggles the setting.

3 Likes

Here’s the walkthrough video for VhacdTuner:

7 Likes

Nice! Great work!
I managed to run it but I had to hack it by changing the material before adding the model to the scene since my model uses a custom shader, maybe adding a button for this would be convenient.

            // in Model::load()
            this.rootSpatial = assetManager.loadModel(assetPath);
            this.loadException = null;
            Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            material.setColor("Color", ColorRGBA.Gray);
            this.rootSpatial.setMaterial(material);

My model had a 4.5x speed up with the new algorithm so I will certainly switch to it.

Something I didn’t like about the tool is the whole guided ranking process, I’d prefer if the “run” button were always present and I could freely try out different parameters without following all the steps.

EDIT: duh! I just realized I’m actually using the static mesh shape for my levels and this is for dynamic shapes :person_facepalming: . Even if it’s no use for me atm it was fun to try it out :monkey_face:

1 Like

I added a button to stop the ranking process.

1 Like