rdInst Tutorial 18 – Creating Instanced Static Meshes from CSV data

rdInst makes it extremely easy to add instanced static meshes to your level. It does all the work of maintaining them.

In this tutorial we will build a level of instances from some CSV (comma separated values) data.


Step 1. Get the CSV data

The first thing to do is obtain a cvs file with the data you want.

I added a tool to rdTexTools to convert textures to csv files which will be available in it’s next update. With this I made a csv file of the puzzle piece logo used with rdMeshTools for this example, you can download that here. It stores an X and Y position in the Red and the Green channel columns on the following structure. Only if the Alpha of the image was over 0.33 is there an entry.


Step 2. Create a Blueprint Structure for the DataTable

Next we create a Structure that contains the values in the csv file. These are simple an index, and 4 float values, once for each channel including alpha.


Step 3. Import the CSV file into a DataTable

Now Right-Click in the Content Browser and select “Import to Game” at the top:

In the window that opens, select the Structure you just created for the RowType:

Then just click the Apply button to create the DataTable containing the pixel information.


Step 4. Create a small Blueprint to populate with the DataTable

Create a new Blueprint Subclassed from rdActor:

Now open it in the Blueprint Editor, and set its “Actor Mode” to “BuildInstances” – then create a new variable – an array of StaticMeshes – make it public by clicking on the eye:

And add a Vector variable called scale – set the defaults to something 10,10,10:

Navigate to the “Construction Script” and edit it to look like this:

Now compile your Blueprint Actor and add one to the level, keep it selected.

Go back to the content browser and select the meshes you want to use and drag them into the “Meshes” list in your blueprint (make sure the blueprint is selected in your level)


Step 5. Done.

That’s it – now in your level, you should see something like: