rdMeshTools Tutorial 9 – Creating new meshes for non-default material actors

In a similar direction as the previous tutorial and tool, rdMeshTools can also create new meshes for each StaticMeshActor that override the default material set.

An InstancedStaticMesh Component can only have one set of materials at present (if UE5.5 or 5.6 doesn’t add support for multiple instanced material sets I’ll add it to the engine myself) so a new component has to be created for each set of materials. This means more draw-calls, so isn’t optimal.

One way around it is to create materials that reference different sets of textures and samples from them – in Blueprint Shaders this is only possible by Lerping each sampled texture together which isn’t optimal. Using HLSL you can create arrays of textures and just read from the desired ones – I’ll be adding a material to rdBuildBuddy that does that with a custom HLSL node. It still means having to create new materials for your assets though which can be time consuming.

Until one of the above is satisfied, this tool can be used. It creates a new mesh asset for each unique material set and replaces the selected actors in the level. Problem solved! Meshes are usually small in size 10-100KB or so and even smaller when compressed in VRAM.

rdInst 1.40 has an auto-instancing system for static actors in your levels which handles negatively scaled meshes and meshes with unique materials – this is for meshes you’ll be wanting to use dynamically – in prefabs, spawn actors and proxies.

This tutorial will create new meshes for the materials being used in the House being used in the previous tutorial, but with the material overrides.

Step 1. Add the House to your level

This time we use rdBPtools to replace the House BP with StaticMeshActors that use their overridden materials:

Using the refine selection tool, we can see that there are 231 mesh actors with overridden materials:

Step 2. Use the “Create Material Correct Meshes” Tool

Now right-click on one of the selected actors and select the “Create Material Correct Meshes” option in the rdMeshTools Tasks submenu.

This then creates the new meshes (or reuses any existing ones) and replaces the actors in the level. When finished it displays a report window.

Step 3. Done.

That’s it. You can save the level with the new meshes.