Importing vertex meshes into Unreal

From Oldunreal-Wiki
Jump to navigation Jump to search

Part 1) Intro

Unreal Engine 1 is one of the older engines which seems to be user unfriendly when it comes to importing new animated meshes into the game. In this tutorial I would like to share my workflow of how I prepare and export meshes from blender and get it into Unreal / Unreal Tournament.

I will use my new RocketCan mesh which I made for Unreal Redux as an example.

Part 2) File Formats And Blender Plugin

Unreal's vertex mesh format requires two different files for the import.

A _a.3d which stores the vertex animation timeline and a _d.3d which stores the mesh data like the UV Map and materials / poly flags.

Thankfully Skywolf wrote an exporter for Blender which allows exporting meshes in the right formats!

Link to the thread + downloads: Skywolf's Blender Vertex Mesh Importer / Exporter Plugin

For this tutorial I will be using Blender 2.80. The plugin for blender works flawlessly in this version I don't know if there will be future updates for the plugin for newer Blender versions.

Part 3a) Preparing Your Mesh - Boundary Box


The most important part is that your mesh is inside of a boundary box with a size of 256 x 256 x 256 Unreal units.
BoundaryBox.jpg

If the mesh leaves that box caused by an animation or if it is bigger, your mesh will get cut and vertices will merge during the import progress.

To check the right sizing and maximize your animation range you can create a new cube in blender and scale it by factor 128 which gives you the right boundary box size


Part 3b) Preparing Your Mesh - Timeline Animation


I setup an simple armature system for the mesh which includes an "Open" and "Close" animation.

  • Frame 1 is the "default" position or the "Still" position the mesh.

Frame1.jpg


  • Frame 3 is the "Open" position

Frame3.jpg


  • Frame 5 the "Close" position.

Frame5.jpg


TIP: If you have looping animations make sure the last frame of an animation is the same frame as the start frame.

Part 4) Exporting Timeline Animationset.

Make sure your mesh is not split into different objects. It's important that all animated parts are stored in one object. Otherwise you will export only one part of it.
If your mesh is only one object select it in Object Mode.
Then go to file → export and select Unreal Engine Vertex Mesh (_a.3d, _d.3d)
ExportImage.jpg

Then choose a name for your Mesh and select under the point "Source:" Scene Timeline
I also recommend checking "Exporting to UCC folder Structure". This generates for you a preset for the import information which I will explain later in Part X)
ExportOptions.jpg

If no error occurs after hitting export your mesh have been exported successfully.


IMPORTANT: Before you export your mesh, make sure you deleted the Boundary Box if you used it.

Part 5a) Preparing The Import

Create a new folder in your Unreal directory and name it like your package will be named. In this tutorial I will name it "NewRocketCan"
PackageFolder.jpg

Open that folder and create new folders named "classes", "models", "sounds" and "textures".
Paste the generated .uc in the "classes" folder and the exported _a.3d and _d.3d files in to "models".
If your mesh has a custom skin put it into "textures" and new sound effects into "sounds"

FolderStructure.jpg
Then go to the System folder in your Unreal installation and open the Unreal.ini and add a new EditPackages line under [Editor.EditorEngine]. I choose EditPackages=NewRocketCan.
Packageini.jpg

NOTE: The .ini entry and the new folder in your Unreal directory must have the same name!

Now navigate to the folder in which you have exported your mesh and copy the .uc, the _a.3d and _d.3d in the new folders you have created in your Unreal installation

Part 5b) Preparing The Import - The .uc File

Skywolf's vertex mesh exporter plugin generates for you a ready to use .uc file which includes all important information which Unreal needs.

I tried to mark and describe some parts in the code so you can customize it to your uses.
DefaultImportUC.png

The changes I will apply are:

  • Changing the parent class to "RocketCan"
  • Applying animation names and set the start frame and the animation length for the "Open" and "Close" animation
  • Removing the texture import information because I use the textures from UnrealShare.u but I will keep the MeshMap settings for each Texture Num (Blender Materials)


After my changes the new .uc looks like that:

ImportUC.jpg

Basically if you have more animations then one you need to tell the .uc file at which frame your next animation starts.

The StartFrame always counts too to the animation length

As we remember the „Open“ and „Close“ animation I made in blender has only three keyframes for each
So the „Open“ animation in my example uses the frames (1, 2 and 3) = NumFrames of 3.

For the next animation the new StartFrame would be the last frame of the „Open“ animation

So I count again for the „Close“ animation the frames (3,4, and 5) = NumFrames of 3.

If you have more animations you need to continue this counting until you reached the end of your animation timeline.


Part 6) Importing Your Mesh Into Unreal

I'm doing it the classic way and use the command prompt to build my packages.
There are different ways to open it. Simply click on the Windows icon in the taskbar and type "cmd" and open the command prompt.
CMD.jpg

Once the command prompt is open you need to navigate with "DOS" commands to your Unreal installation.

  • use "cd.." to navigate one folder backwards
  • with "F:" you can go to another hard-drive
  • use "cd" to open a folder


Once you reached Unreal/System execute "ucc make". This command will build all your packages you have set in your Unreal.ini under "EditPackages".

CMD2.jpg

NOTE: If your package ( the .u file ) still exists in the System folder, the package won't build.
TIP: Make a safety copy of your still existing package and delete the .u which shares the package name you want to build.


After you executed "ucc make" the program will tell you if errors during the import happened and tells you exactly what's wrong.
In my case the mesh imported successfully without any warnings.
CMD3.jpg


Part 7) Fine Tuning And Adjustments


Once your new actor has been successfully imported into the game open the editor and navigate to it's location in the actor browser. In my case it's a subclass of RocketCan.

Inventory.jpg

Select your new actor and place it into the level and check if the mesh has the right origin, rotation and scale.
In my example I want to have a similar origin, rotation and scale like the original RocketCan actor. After the first import the mesh is far away from it's final positioning.

WrongPosition.jpg


Okay let's fix this

  • Open the editors MeshBrowser
  • Navigate to your new Package and select your Mesh
  • open with edit the Mesh Properties


MeshPropertiesPath.jpg
Now a properties window opened where you can setup your mesh- origin, rotation and scale.
RocketCanMeshProps.jpg

IMPORTANT NOTE: In pre 227j versions the rotation settings are not in degrees! Also the rotation import information written in the .uc uses different values.
Examples:

  • 90° in the .uc equals a value of 64.
  • 90° in pre 227j editor versions equals a value of 16384.


If you change the values in the Mesh properties UnrealEd gives you real-time feedback to your changes.

The changes I made for my mesh are:

  • Origin Y = 20
  • Rotation Roll = 90° ( Pre 227j Roll = 16384 )
  • Scale X and Y = 0.125
  • Scale Z = 0.25 ( always double size of X and Y )

RightPosition.jpg


Part 8) Final - Apply The Changes To The .uc