logo80lv
Articlesclick_arrow
Research
Talentsclick_arrow
Events
Workshops
Aboutclick_arrow
profile_loginLogIn

Converting a Static Rigid Body Simulation into a Dynamic Physics Actor in UE4

Collin Harris shared an article on a way you can integrate the animated FBXs that Houdini exports into a more real-time solution.

Collin Harris shared an article on a way you can integrate the animated FBXs that Houdini exports into a more real-time solution.

Summary

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 into 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 networks 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.

I’ll be going down and describing the function of each node top to bottom. If you need a larger view of the VOP network, feel free to click this link here.

  • “box1” (box)
    1. You have to start with some kind of geometry in order to fracture geometry, so I started with a box node. You could replace this with any static mesh or primitive node and it would function as expected.
  • “transform” (transform)
    1. This transform node is there to resize the 1x1x1 box into something more interesting. So in this case, I made it look more like a wall. You are able to adjust primitive parameters in the primitive node (box1), but I have found that separating out the transform makes it easier to access and alter the transform data when it is it’s own node.
  • “convert_to_fog” (IsoOffset)
    1. So here is where the magic starts to happen. Here we are converting our primitive mesh into a fog volume in order to sample random points from.
  • “chunk_centers” (Scatter)
    1. Now we’re using a Scatter node to assign Vector3 points to randomly selected fog particles from our above IsoOffset node.
  • “voronoifracture1” (vornoifracture)
    1. This node takes all of the points that Scatter selected, and using its set parameters, generates fracture points.
  • “uvtexture1” (uvtexture)
    1. This node automatically UVs your newly generated chunks of geometry.
  • “setup_packed_prims” (Assemble)
    1. This node can be ignored as it is an automatically generated node that is created when you export your node.
  • “rest1” (rest)
    1. This node can be ignored as it is an automatically generated node that is created when you export your node.
  • “attribvop1” (attribvop)
    1. This node can be ignored as it is an automatically generated node that is created when you export your node.
  • “dopimport1” (dopimport)
    1. This node can be ignored as it is an automatically generated node that is created when you export your node.
  • “EXPORT” (null)
    1. Whenever I am done with an object that I want to export, I drop in an empty Null node so that when I go to export the object, I’m not digging through node named with hard to remember titles. This is the node that I will be selecting when I eventually export everything out.
  • Now that we have our basic object fracture, let’s export this to Maya and 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 everything 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!

    If you have any additional questions, or want to learn about the Houdini to UE4 pipeline, feel free to hit me up on Twitter: @grossbloy.

    Collin Harris, 3D Artist

    Join discussion

    Comments 0

      You might also like

      We need your consent

      We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more