Geometry output scrambling during animation stepping

   2147   1   0
User Avatar
Member
9 posts
Joined: Nov. 2017
Offline
So a long time ago a wrote a script that depends on the houdini plugin to create a rigged rigid destruction asset

Basically you give the tool a mesh, ensure (after some asset attribute tweaking) the Split Geos By groups is checked and the houdini tool itself ensures the fracture is grouped correctly.

Then I have a script that:
goes through each sub group of the asset
keeps track of 4 points for each mesh/group to define a transform matrix.
assigns said transform matrix to a joint
keys the joint
repeats for a user provided range of the maya timeline

Now I occasionally had assets that completely did not play nice with the scripted baking process to have a destroy animation.
Random parts of said assets would freak out and go on a moon logic jaunt through the scene jumping around wildly.

So I decided to keep some of these trouble makers to the side and try to figure out why this was happening or if it's because I didn't take some mathematical details (co linearity) into account during the baking.

Now I'm checking up on this and I'm finding that for no apparent reason the output groups seem to randomly scramble which group is what geometry. (a good give away is I have an end position geo coming out at the same time that is supposed to be called FinalPose, but it's starting to show up as a Piece group instead)
For a moment I thought re-syncing the asset every frame could maybe work, but then the mesh output names (piece1_2, piece2_3 become piece1_0, piece2_2) start to change and would force me to parse on group names instead.

So before I do the mother of all hacks to keep track of all the destruction pieces by doing resyncs and string parsing.
Is there a way to make sure houdini doesn't scramble the geometry output meshes between frames as I step through an animation frame by frame?
User Avatar
Member
9 posts
Joined: Nov. 2017
Offline
I've manage to work around the odd animation stepping behaviour for now.

I'm giving each baking class awareness of it's previous frame positions and all of the bake parts instead of just the one they are supposed to follow.
Then on baking a new frame I go over the bake parts, compare vertex counts and keep the parts the have the same vertex counts in a list
after that if only one piece matched I make an open maya function mesh out of that and return it to the baking method

if multiple matched I get the same point indexes (determined on the first frame) from each part and check their distance from the previous bake frame.
If on average it's the shortest distance I select this piece to make a function mesh out of.

Additionally instead of selecting vert 0 -> 3 to follow per mesh I select random vert indexes so the distances are as unlikely to match between part comparisons as possible.

At the moment this seems to be about 90% more stable than my original script and because of the random indexes a rebake can turn out better if errors or moon logic jaunts through the scene do happen.

If somebody can provide insight into getting the mesh output from houdini more stable between frames, then I'd still love to know it.
  • Quick Links