Download

Merge actors & datasmith re-imports

In CAD, a product/installation/building can often contain hundreds or thousands of parts, all of which I believe are imported with Datasmith as hundreds or thousands of individual objects.

I’ve only briefly looked online, but there’s something called “merge actors” which is used to “reduce draw calls” that seems to be an often used optimization.

Can this be used on Datasmith imports, and more importantly, what happens if you try to re-import something after having done this?

Is there a video tutorial on this topic, by the way, because it seems to be something that will be in even higher demand now, than in the already optimized gaming assets that Unreal ususally handles.

Hey,
yes, you can definitely use the Merge Actors tool for this kind of scenario, or the Proxy geometry tool (which is in the same dialog box as Merge Actors) with Datasmith imports.

You’re exactly right that this will reduce draw calls – each different material on each different object is rendered in a separate draw call, and each draw call involves a small amount of overhead on the GPU. By merging together Actors that contain the same Materials, you can reduce the total number of draw calls.

However, there’s a balance – if you merge so many actors that your geometry gets really big, you may have issues with static lighting due to not being able to get enough lightmap resolution. Or, if you merge actors together when they’re too far apart, you may reduce the ability of the engine to “cull” objects outside the camera view – normally the engine won’t render objects that are out of view, but if you merge together actors that are far apart, then part of the actor is more likely to be in view at any given time.

When you re-import, the changes that you’ve made will persist – you’ll still have the new merged actors you’ve made, and the actors you’ve removed from the Datasmith scene will still be removed (unless you check the Respawn Deleted Actors option in the Reimport dialog). However, the problem is that if any of those merged actors have moved around in the source scene, your merged actor won’t get updated with those changes. Similarly, if you’ve added new objects in your source scene, the reimport process will bring them into the datasmith scene as new actors, but they won’t be merged into the merged objects you created. This may or may not be a problem in your case.

Generally, the way I’d recommend handling this for now is to do your merging (as well as any other data prep you need to do) in a Python or Blueprint script. That way, by re-running the script each time you reimport, you can easily repeat exactly the same merging process, to make your merged actors pick up the new positions of any modified objects in the source scene.

Great, thank you for the information and tips!