Rigid Body Fx For Games Using Houdini & Unreal Engine (Part 1)
A good destruction Fx for real-time can be done in multiple ways. So I decided to test some of those workflows and here I am sharing some of my learning from it. One such workflow is to simulate rigid body dynamics in Houdini and export the data for the game engine. Then we can use the data in engine for either gameplay and non-interactive elements or for cinematic purposes. Another way to do such effects involve real-time physical simulation on objects. This involves runtime calculations and is comparatively costly. So based on the specific requirement, we can choose either way to do it.
In this Part 1 of the blog, I will be sharing the baked data techniques where I have used Houdini and Unreal for this workflow but this can be done on any other game engine as well.
Rigid Body Destruction (Baked solution)
(Rigid Body Destruction in Unreal)
The above effect is done using a combination of both baked and real-time elements. The baked data are for the rigid body pieces which I have created with two different methods.
1. FBX Workflow
2. VAT Workflow
1. FBX Workflow
In this method, we first do the RBD simulation in Houdini and then save the simulation data into a FBX file using the SideFx Labs RBD to FBX node where each rigid body piece gets a bone attached to it and the data is baked into the bones which contains the animation data.
(Rigid Body Simulation in Houdini)
Then the FBX is imported into Unreal Engine as skeleton mesh and can be used directly.
(FBX Skeleton Mesh in Unreal)
Performance and Optimization
We can use this solution for many different types of effects and have to keep in mind that since this is a skeleton based animation data, this runs on CPU. From optimization point of view, we should keep a check on the number of pieces we simulate and the complexity of the pieces too. To get more rich of an effect like in the first video, I have combined the FBX output with lots of in-engine particle debris and trails which is more cost effective rather than simulating too many pieces in the first place.
(Engine based particles for adding detail to the effect) |
Rigid Body FBX with Gameplay
The
FBX workflow is not only useful for non-interactive effects but can
also be used in certain gameplay scenarios. However there are
limitations of this because the animation data is fixed and is not
based on runtime. These can be used in places where we do not need to have
very accurate physics effects as this can provide a cheaper solution to a
lot of games.
(RBD FBX with Gameplay)
2. VAT Workflow
In this method, after the simulation in Houdini we export the asset as static fbx and the simulation data in texture format where the vertex information of the asset per frame gets stored. There are multiple information we can get in the textures such as position data, rotation data, vertex color, pivot position and much more. SideFx Labs has Labs Vertex Animation Textures node which makes it very easy to export the asset and the textures from Houdini. This is somewhat similar to the Vertex Animation Tools in 3d Max.

(VAT Data Export in Houdini)

(VAT Textures)
VAT setup in Unreal
In the Engine we need to import the textures and the fbx asset with correct import settings. For the textures we can either modify the settings manually or SideFx provides an editor utility script which helps to define the correct texture settings. Then we need to create a VAT RBD master material which can be used for any type of VAT based RBD asset in the engine.
We create the required material instances and assign to the asset material IDs. The beauty of this instance is that it has all the necessary parameters to setup the VAT textures data. We then plug the textures to their corresponding slots and can see the result. There are many other key parameters like playback speed, auto playback, which can be tweaked based on our requirements.
(RBD VAT Material Instance Setup)
VAT Workflow for Cinematic
The VAT technique can also be used for cinematic purposes which is really great because we can push for more detailed output in the engine using this technique. We can use this with Unreal Sequencer and can control the effect however needed.
(RBD VAT in Unreal Sequencer)
Performance and Optimization
The VAT process is calculated on GPU and thus it is very effective for most scenarios. This process provides very good performance and lots of possibilities for making various kinds of effects. But we also need to consider the texture memory footprint and do not want to have a GPU bottleneck. Specially for medium to low end target hardware, we need to be careful about how much we want to push for this. Also, to get more out of this, we can always add some in-engine particles to make it more believable.My Thoughts
Both of these techniques are really nice and they have their own advantages and limitations. I am also very curious to see how the advanced VAT techniques with gameplay pans out in future. Like many of you, I also believe that there is no one fixed solution for everything and that too specially in game development. With the rise in technology, we have more power than ever before but we have to use it very responsibly. We have covered the Baked Rigid Body solution for game engine in this Part 1. In Part 2, I will be covering the Real-time Rigid Body destruction workflow in engine. So keep developing and stay tuned for more.
Cheers!
Comments
Post a Comment