Jump to content

Triangle-based physics weights: Episode 3

Drongle McMahon

You are about to reply to a thread that has been inactive for 4066 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Warning: Reading the following may damage your brain. Proceed at your own risk.

Having abandoned my attempt to work out what is causing the strange triangle-based physics weights, described in previous episodes, I have been trying instead to find some guiding priciples to minimize the weights. I should say at the outset that I have not really met with much success (yet). I started to look at the effects of triangle and vertex ordering for more practical shapes. In episode 3, I will describe some results with simple cylinders, where optimal conditions were found.  Then in episode 4 I will describe some attempts to use that information where the cylinders are part of a more complex shape.

The picture here shows the weights obtained for some 12-sided uncapped cylinders. The collada files used were made by manual editing of an initial file exported from Blender. They contain no UV map data and (mostly) no normal data, as that makes it easier to edit the order of triangles and vertices in the <polylist>. In many experiments, I never found any difference in the triangle-based physics weights resulting from the removal of the UV map and/or normals.

When you triangulate a cylinder in Blender, the collada exported has a <polylist> with the triagles listed going around the cylinder, first those with edges at the top, then those with edges at the bottom. Autodesk exports have the triangles listed in order around the cylinder, not separated. This is more natural, as it places pairs of triangles comprising each quad face next to each other. So the data here is from files rearranged in that way. Using the original Blender order gave essentially identical weights, except for a vertical shift in part of the table.

The table in the picture shows four sections representing different starting cylinders, as indicated in the diagrams at the top. In c12perp, the default cylinder is rotated 15 degrees so that it has faces perpendicular to the x and y axes. In c12pnts, it is the default cylinder with points on the axes. In the two sections on the left, the diagonals were as generated by triangulation in Blender. In the  two on the right, the diagonals were then rotated, so that they connected the other two corners of each quad. The cylinders were all 2m tall and are scaled to be 0.5x0.5m in the xy plane, so as to avoid the hidden switch to convex hull for any smaller dimensions.

Within each section, the only changes were to the orders of triangles in the <polylist> and to the order of the vertices in the first triangle in the list. The vertex positions were unchanged, so that the actual inworld geometry is identical. Vertical columns show the effects of cyclic permutation of the order of triangles in the <polylist>, bringing each triangle in turn, going around the cylinder, to the top of the list. The three columns for each row show the three cyclic permutations of the vertex order for the first triangle in the list. The vertex orders for the remainder of the triangles were kept in the original order.

Non-cyclic vertex permutations, which alter the winding and the implied normal were not investigated. They do change the weights, but also change the physics behaviour. It is easier to walk through from the "back" of triangle-based shapes.

The investigation was done this way because earlier experiments, randomising the order of other triangles, had indicated that only the choice of the first listed triangle affected the weight. However, some results showed that the vertex order in triangles elsewhere in the list, especially the second, can affect the weight. So only a tiny fraction of the possible orderings in the <polylist>, without altering the geometry, were actually investigated here.

Red coloured cells in the table show absurdly high physics weights, of several thousands, that appear with some configurations. These greatly exceed the maximum limit implied in the physics weight wiki, showing something wrong with the clamping described there. The variation in the relatively sane weights is shown by the lengths of the blue bars. They range from 1.3 to 30.7, still over more than 20-fold.


The lowest weights, below 2, are only found with the rotated normals, for either orientation of the base cylinder, and the lowest of all, 1.3, also required changing the vertex order as well as the triangle order. Note that in most faces (pairs of first triangle rows) there is a shared pattern with three cells each of two different values depending on the vertex rotation.

This is a lot of work to find the <polylist> that gives the lowest weight. Is it possible to get there without editing the collada file? Perhaps by just rotating the cylinders so that the first listed triangle is at geometrical positions equivalent to thgose achieved by editing the polylist? Testing this for the c12pnts triangulated cylinder, rotating and exporting at 30 degree rotation intervals, so that there are always  points on the axes is not promising. The range of weights found was 7.1 to 29.9 (excluding one silly one at 5904.2); at least 5x the minimum weight. Doing the same thing with rotated diagonals gave values between 3.1 and 9.4, and with an untriangulated cylinder, 3.2 to 8.3. The minimum of these is still more than twice the lowest weight in the table. So it seems that only by a tedious investigation can we obtain the lowest weight, and that this requires both rotating the diagonals from those produced by default triangulation and permutation og the order of vertices in the first triangle in the <polylist>.

Similar, though not quite as extensive, investigations were done with 8, 6 and 4 sided cylinders. The general picture was similar, although the range of weights became less wide as the number of sides was reduced. Some weights of many thousands were found for the 8-sided cylinder, but not for the 6 or 4 sided cylinders.

So the question is whether all this information can provide a way to mitigate the physics weights of more complex triangle-based physics shapes. At first sight, there is no hope, but if it's true that the first triangles have the greatest effect, then perhaps importing a manually optimised simple shape from its collada file, so that it's first in the triangle list, then building the rest of the complex shape onto it, will help at least to avoid the highest weights. Episode 4 will investigate this possibility.

ETA : note that all this was done on Aditi - can't afford the uploads on Agni. Last I checked, there was no difference in the weight calculations between grids, but of course that situation is potentially fluid.

  • Like 3
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4066 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

  • Create New...