This page explains how to bring your Twinmotion projects into Unreal Engine using the Export to Datasmith file command in Twinmotion.
For an overview of the workflow, and to understand how Datasmith translates Twinmotion content in Unreal Engine, see Overview of the Twinmotion to Unreal Engine Workflow.
Steps in the Workflow
A typical Twinmotion to Unreal Engine workflow is as follows:
Export your Twinmotion project to the Datasmith format (
.udatasmith
) using the Export to Datasmith file command. This creates a.udatasmith
file that Unreal Engine can recognize, and assembles all the assets used in your project (textures and.udsmesh
files) into one folder.Import the
.udatasmith
file and assets into Unreal Engine.If your Twinmotion scene contains a landscape, you must recreate a new landscape in Unreal Engine using the imported heightmap and materials of the landscape.
Prerequisites
Unreal Engine
Unreal Engine 5.4 or higher must be used to import Datasmith files exported from Twinmotion.
The Unreal Engine Datasmith Importer plugin must be enabled in Unreal Engine before you can import Datasmith content into Unreal Engine.
Using the Workflow
This section explains how to bring your Twinmotion projects into Unreal Engine using the Twinmotion to Unreal Engine workflow.
1- Export a Twinmotion Project to Datasmith
In Twinmotion, open the project you want to export.
Click File > Export to Datasmith file, and choose either Standard or Optimized mode.
Optimized mode leads to better performance in the Unreal Engine project, as it reduces the number of Static Mesh Assets and Material Assets when you import the Datasmith file into Unreal Engine. However, it can increase the export time and lead to unintended consequences when making changes to Static Mesh Assets or Material Assets in Unreal Engine.
For more information about the Standard and Optimized modes, refer to Standard and Optimized Exports.
Select the folder where you want to export the
.udatasmith
file and assets. When exporting a Twinmotion project, you have two options. You can export directly to an already created Unreal Engine project, or you can save the files to another folder and manually import them later to an Unreal Engine project.To export to an Unreal Engine project, do as follows:
In the Export to Datasmith window, select the root folder of the Unreal Engine project where you want to save the
.udatasmith
file and assets and enter a file name.
To export to a folder, do as follows:
Create a new folder anywhere on your computer. For example,
C:/Users/[username]/Documents/[Lakehouse]
.In this new folder, create a subfolder named Content. For example,
C:/Users/[username]/Documents/[Lakehouse]/Content
.In the Export to Datasmith window, select the
C:/Users/[username]/Documents/[Lakehouse]
folder to save the.udatasmith
file and assets and enter a file name.
Click Save. The Export to Datasmith window appears and shows the progress of the export process.
Once the window closes, the
.udatasmith
file and assets are saved in the folder, and a new folder named Twinmotion is created inside the Content folder.
2- Import the Datasmith files into Unreal Engine
The procedure to import Datasmith content into Unreal Engine is the same for any application, whether it is content exported from Twinmotion or from another supported application. The instructions below provide a brief overview on how to do this. For more in-depth information on how to import Datasmith content into Unreal Engine, see Importing Datasmith Content into Unreal Engine in the Unreal Engine documentation.
In step 3 of the previous section, if you exported your Datasmith content to a folder rather than directly to an Unreal Engine project, follow these steps before proceeding. If you saved your content to an Unreal Engine project, proceed to the next step.
If the Datasmith files you are importing were not created in the root folder of an Unreal Engine project:
Move the .udatasmith file and assets folder to the root folder of your Unreal Engine project. For example:
C:/Users/[username]/Documents/Unreal Projects/[MyProject]
.Move the Twinmotion folder located inside the Content folder to the Content folder inside your Unreal Engine project. For example,
C:/Users/[username]/Documents//Unreal Projects/[MyProject]/Content
.
In the Unreal Engine project, open the Create menu and click Datasmith > File Import.
In the Import Datasmith window, select the
.udatasmith
file saved in the root folder of the project and click Open.In the window that opens, select a location to store the imported content You can create a new folder under the Content folder or save directly there. When you are ready to import, click OK.
In the Datasmith Import Options window, select the types of content you want to import, configure the import options, then click Import.
We recommend deselecting the Generate Lightmap UVs check box to ensure vegetation in the scene is rendered correctly. When the Generate Lightmap UVs check box is selected, the leaves on vegetation do not render correctly and the Invalid Lightmap Settings message appears. To correct this, close the Unreal project and reopen it.
The Unreal Datasmith dialog box opens and the import process starts.
When the process completes, the content is imported into the current Level inside the Unreal Editor.
3- Create a New Landscape with the Heightmap and Materials
When a landscape is imported into Unreal Engine using the Twinmotion to Unreal Engine workflow, the landscape is imported as a static mesh. However, the heightmap image and the materials are not applied correctly to the mesh. If the original Twinmotion scene contains a landscape, you must recreate the landscape in Unreal Engine using the imported heightmap image, materials, and coordinates of the original landscape mesh.
The steps below explain how to create a landscape in Unreal Engine using a landscape imported with the Twinmotion to Unreal Engine workflow. To get acquainted with the basics of the Landscape System in Unreal Engine, see Landscape Quick Start Guide in the Unreal Engine documentation. For more in-depth information, see the Landscape Outdoor Terrain section, including Creating Landscapes.
In the Modes drop-down menu, select Landscape to open the Landscape Tool.
Select the Manage tab to go into Manage mode.
Select New, then Import from File.
Locate the heightmap image by clicking the ellipsis (...) next to Heightmap File.
In the Import window that opens, select the heightmap image in the assets folder and click Open.
The heightmap image is applied to the landscape mesh.
In the dropdown next to Material, select the MI_Terrain Material Instance.
Click Layers to show the layers that compose the landscape. The number of layers corresponds to the number of textures used in the landscape.
Create one Layer Info object for each layer that has a corresponding texture by clicking the Plus icon to the right of the layer, and selecting Weight-Blended Layer (normal).
A Twinmotion landscape can contain up to four textures. During the Export to Datasmith process, one Terrain_Weightmap_x.png texture file is created for each texture used in the landscape, where x corresponds to the number of the layer in Unreal Engine.
In the window that opens, select where you want to save the Layer Info object and click Save.
Click the ellipsis (...) next to the first layer (Layer0).
When the Import Layer window opens, select Terrain_Weightmap_0.png in the assets folder and click Open.
Repeat steps 8 to 11 for each subsequent layer that has a corresponding texture file.
Click the Import button.
The landscape is created and appears in the Viewport.
In the Modes drop-down menu, choose Selection to go into Selection mode.
Select the original landscape in the Viewport or the Outliner.
In the Transform section inside the Details window, take note of the Location, Rotation, and Scale values of the original landscape. These values must be identical in the new landscape.
Select the new landscape in the Viewport or Outliner, and in the Transform section, verify the Location, Rotation, and Scale values. If they differ from the values of the original landscape, enter the correct values.
You can now delete the original landscape static mesh by selecting it in the Viewport or Outliner and pressing the Delete key.