General / 24 February 2020

Houdini Blog #37: Unreal Instancing

This post will be talking about instancing with Unreal engine. Some parts of instancing in Unreal engine is not clear to every one, so I decided to make a breakdown of instancing.

Further on my builder tool it has a little bit improvements. Mainly made models and updated shaders in Unreal.

Here is also a breakdown of the modular set.


Instancing

Instancing is the ability to draw the same object multiple times. It uses all the same vertices and graphics pipeline each time. It avoids the overhead of the program asking to have the object drawn over and over again.

With Houdini and other software like Unreal and Unity, it is possible to use instancing. This will result is a performance boost.

Method 1: copy to points

The first way of using instancing is by enabling it in Houdini. This is often found in nodes and the common node I use for this is the copy to points.

Opening an HDA with a copy to points and instance on will result in this.

You now have exclusive inputs for instance models. In here you can place custom models from your Unreal project.

This method is the easiest one to setup in Houdini and get results. Downside is that in Unreal you will have to assign the correct model to instance.


Method 2: attribute instancing

Then the second method is using attributes. With the copy to points you use a placeholder as instance but what if you want to get the right model to be instanced by default.

So that is where attributes are come in handy. On attributes will be information stored on what model to use from Unreal, in other words the attribute will contain a path to an asset.

To use this you won't be using a copy to points and instead on these points place an attribute create. Then fill in the right name for the attribute called 'unreal_instance'.

The type will be a string and in this string is the path to the model you want to copy on it.

The path for Unreal assets is something special. For Unity it is just 'Asset/Models/my_model.fbx'

To get the correct path from Unreal Engine right click on an asset and use Copy reference.

Paste this reference in the attribute string.

Unreal Paths will look like this:   StaticMesh'/Game/Models/Sci-fi_Panel.Sci-fi_Panel'   (You can see the structure  'type' + 'Path')

A cool trick with attribute instancing is that you can use this with an attribute random. 

In general the attribute instancing can take a bit more setup in Houdini but there is a lot of benefits from this. Such as not having to assign in Unreal what models to instance and since you are using attributes it can be randomize or controlled in different ways.

More on the Houdini with Unreal plugin can be found here: https://www.sidefx.com/docs/unreal/ 

Instancing in action

Once instancing is setup it can work pretty fast. The demo below here is in real time with my tool.


That was it for this post. Hope you enjoyed it and see you on the next one.

Special thanks to my patreons.