I have been using Houdini for the past few months. I absolutely love the amount of control and flexibility that SideFX has embedded into Houdini’s core, but I’ve found it difficult to incorporate a lot of the incredible simulations and fx that I created in Houdini into my Unreal pipeline (due to their static nature).
So I set out to find a way to integrate the animated FBXs that Houdini exports into a more real time solution.
What I came up with was fairly simple. Instead of placing the animated simulations straight in to my level, I set up a bit of logic to switch the joints from statically animating, to being influenced by Unreal’s physics engine.
I decided to write out my process from start to finish in the hopes that this will help anyone interested in taking their static simulations, and utilizing them in a more dynamic situation.
Step One: Houdini
So here we approach our first stage of the tutorial. In order to generate our destructible object, we need to simulate it first in Houdini. In the left image you can see the simulation playing in Houdini’s preview window. In the right image, you can see the note network that I’m using to define the fracturing of the object. I'll break down some of the VOP network that I used to simulate the destruction, but just keep in mind that this will work with any rigid body simulation, not just what I made above.
Now that we have our basic object fracture, lets export this to Maya and then import it into Unreal!
Above you can see the Game Development shelf in Houdini. You’re going to want to click the RBD to FBX button you see outlined in red above.
Above we have the node settings for the RBD to FBX node. This is where you set all your important settings like what directory to export your FBX to, and what Node you want to export. So we’re going to select our Export node that we made in the previous section, double check that we’re saving it to the correct location, and triple check that our start and end frame are correct. Then once all of that is done we are going to hit the Render button on the top left.
Provided you don’t get any ominous error messages, congrats! You now have a fully rigged and animated FBX of your destruction.
Step two: MAYA
Now that we have our baked FBX, we can take it into Maya for cleanup. Here you can fix shading errors, UV issues, and any other small issues that you might want to take care of before importing into UE4.
Step three: Unreal Engine
Once you are ready to import the FBX into Unreal, there are a few gotchas to watch out for. First, make sure when you import your file, you have the import animations box checked. Once you have the file in UE4, we’re going to want to test the animation to make sure it looks correct.
Select your destructible wall mesh, and in its animation properties select the destructible animation that imported with the mesh. Then either play or simulate the scene to make sure that your animation is looking correct. Once every thing looks good, drop into the physics body of the FBX and make sure that there is collision built on each piece, and not just on the root joint.
Once everything is working, we’re going to want to create a blueprint class. You are going to want to import your animated FBX into the blueprint class, and repeat what we did before by specifying the animation in the properties of the FBX (in the blueprint class this time).
Now we’re going to go to our event graph and set two variables (as pictured above). First, we are going to set the collisions of our mesh to interact with other objects in our scene. Next, we are going to set a small delay to let our FBX play it's animation before enabling physics on the joints (otherwise the mesh will just splinter apart with no velocity). And finally, after the delay ends we are going to simulate physics on our FBX.
With all of these elements combined we should have a static simulated destructible that is able to interact and collide dynamically with other actors / assets in our scene.
Below you can see a video of it in action! Neat!