Alembic File Importer

Choose your OS:

This is an experimental feature that is currently undergoing development. Some aspects may not work as expected or may change in future revisions.

The Alembic file format (.abc) is an open computer graphics interchange framework that distils complex, animated scenes into a non-procedural, application-independent set of baked geometric results. Unreal Engine 4 (UE4) allows you to import your Alembic files through the Alembic Importer which gives you the freedom to create complex animations externally, then bring them into UE4 and render them in real-time.

Importing of Alembic files can be performed in a similar manner to several of the other forms of importing content into UE4.

You can also watch the Unreal Engine Live Stream on Animation Topics which include the Alembic File Importer:

Exporting Alembic Caches

When choosing to export your Alembic Cache files from your preferred DCC package, there are some options that you will want to consider:

Choose Your 3D Art Tool

Autodesk Maya

Autodesk 3ds Max

  1. From the File Menu under Cache and Alembic Cache, select Export All to Alembic... (or Selection) based on your needs. Maya_01.png

  2. In the Export window under Advanced Options, enable UV Write and Write Face Sets options, then click Export.

    Maya_02.png

    You will need to enable Write Face Sets if you plan to create Materials during import into Unreal Engine 4 as Materials are created based on found Face Set Names.

  1. From the File Menu, click Export.

    Max_01.png

  2. Specify a save location and change the save type to Alembic (*.ABC), then Save.

    Max_02.png

  3. Define the Alembic Exporter Options based on your needs.

    Max_03.png

    Option

    Description

    File Format

    Ogawa is newer, faster and offers smaller file sizes compared to HDF5.

    Cache Time Range

    This is the same as Maya (Single is one frame, Active Segements is user set Time Slider and Frame Range).

    Every Nth Frame

    Allows you to skip frames (for example: 2 would mean 0-2-4-6-8-10 etc.)

Importing Alembic Files

To import an Alembic File into Unreal Engine 4:

  1. Inside the Content Browser, click the Import button and point to your .abc file.

    Import.png

  2. The Alembic Cache Import Options window will appear where you can define the method/options for importing.

    Import03.png

    Highlighted above at the top of the window, you will see the name of the file and location you are importing from. You will also see checkbox options for the assets within your file that you can choose to import or exclude from the import process.

Import as Static Mesh

During the import process, you can define how to import your content. By default, the Alembic Import Type is set to Static Mesh.

Import04_sm.png

When importing an Alembic cache as a Static Mesh, this will import only the first frame as one or multiple Static Meshes. A single frame from the Alembic animation will be imported as a Static Mesh asset and no animation will be applied. When choosing this import method, there are some setting you can use to define how the asset is imported which are outlined below.

Sampling Options

Option

Description

Sampling Type

The type of sampling performed while importing the animation.

Option

Description

Per Frame

Samples the animation according to the imported data (default option).

Per X Frames

Samples the animation at given intervals determined by Frame Steps.

Per Time Step

Samples the animation at given intervals determined by Time Steps.

Frame Start

Starting index to start sampling the animation from.

Frame End

Ending index to stop sampling the animation at.

Static Mesh Options

Option

Description

Merge Meshes

Whether or not to merge the Static Meshes on import (this can cause problems with overlapping UV-sets).

Propagate Matrix Transformations

This will, if applicable, apply matrix transformations to the meshes before merging them.

When importing an Alembic file as a Static Mesh, if your data contains several meshes within it, you can choose to Merge Meshes into a single Static Mesh inside Unreal Engine. If you uncheck this option, each mesh within your Alembic file will be imported into UE4 as an individual Static Mesh instead of joined together.

Another thing to consider when enabling Merge Meshes is whether or not to Propagate Matrix Transformations prior to merging the meshes. This will take the transformation data contained within the Alembic file and propagate it to the meshes upon merging so they retain their transform data.

Consider the sample scene created below which we export as an Alembic cache.

MayaObjects.png

When we import the file into UE4 as a Static Mesh with Merge Meshes and Propagate Matrix Transformations we get the following:

ImportMesh1.png

If we Merge Meshes but uncheck the Propagate Matrix Transformations we get the following:

ImportMesh2.png

Each of the meshes are merged at the 0,0,0 origin.

Normal Calculation Options

Option

Description

Force One Smoothing Group Per Object

Whether or not to force smooth normals for each individual object rather than calculating smoothing groups.

Hard Edge Angle Threshold

Threshold used to determine whether an angle between two normals should be considered hard (closer to 0 means more smooth).

Recompute Normals

Determines whether or not the normals should be forced to be recomputed.

Ignore Degenerate Triangles

Determines whether or not the degenerate triangles should be ignored when calculating tangents/normals.

How Normals are Calculated

The following is a high-level overview of how normals are calculated based on the Import type and how normals are used within the file to be imported.

  • When importing a file that contains normals for all frames:

    • For Static Meshes / Geometry Cache - the existing normals are used.

    • For Skeletal Meshes - the normals from the first frame are used to determine smoothing groups, which will be used to calculate normals for the average frame and all the bases/morph-targets (we do this in all cases).

  • When importing a file that contains normals for only the first frames:

    • For Static Meshes - If using frame 0, we use the existing normals. Otherwise we calculate smoothing groups and normals for the requested frame.

    • For Geometry Cache - we calculate smoothing groups and resulting normals for all the frames.

  • When importing a file that contains no normals:

    • We calculate non-smooth normals, generate smoothing groups according to the calculate normals and recalculate normals with the smoothing groups.

When enabling Recompute Normals, the path specified above is used (for no normals).

When importing as a Skeletal Mesh, if your animation has big normal delta you may run into issues getting correct looking normals. This is a known issue caused by the way morph-targets can alter the face/vertex normals. As a workaround, you can bypass this problem by using the (experimental) skin cache feature.

To enable this, add the following to your ConsoleVariables.ini file:

r.SkinCache.CompileShaders=1
r.SkinCache.Mode=1
r.SkinCache.RecomputeTangents=1

This should recompile shaders the next time you start the editor. When you open up the Skeletal Mesh asset you should be able to tick the Recompute Tangent option for each material/section.

How Smoothing Groups are Calculated

If you are getting hard edges on the meshes you are importing, you may want to look at the Hard Edge Angle Threshold as well as how smoothing group calculation is performed.

1.0 Hard Edge Angle

0.0 Hard Edge Angle

To calculate Smoothing Groups, first the vertex/face normals are calculated which are then used to look at all the connected faces for a particular face. By calculating the angle between the normals we can then determine whether or not an edge is hard or soft (similar to the soft/hard edge tool in Maya). Below, the image on the left we would consider a soft edge while the image on the right a hard edge. This is becuase the angle between the two normals in the image on the left is smaller than that of the angle of the two normals in the image on the right.

NormalsExample.jpg

Knowing this, we use a dot product to generate a range from 0-1 as a threshold to define when something should be hard versus soft. For example, a value closer to 1 would mean that the angle is larger resulting in a hard edge while closer to 0 would mean a soft edge. This information is then used to generate groups of normals which share soft edges. For each of these groups we smooth the normals across the faces creating smooth faces.

Forcing one smoothing group per object will make each individual object completely smooth (all soft edges).

Import as Geometry Cache

When importing as a Geometry Cache, a new type of animation asset is created that allows playback of vertex-varying sequences.

Import04_gc.png

The imported Alembic animation will be played back as a Flipbook of frames and performance will scale with your mesh's complexity.

This may not be optimal in all cases and is considered as an experimental import option.

Import options for this type of import method include the same Sampling and Normal Calculation options as the Static Mesh import option. Importing as a Geometry Cache also includes the ability to create Materials according to found Face Set names (this will not work without Face Sets you define in your external application and are exported along with the Alembic cache).

As of now, Geometry Cache assets do not support an adjacency buffer which is required for tessellation setup. As a work around for this, you could instead import an animation as a Skeletal Mesh with Morph Targets (which is a more compressed way of importing) as this will support tessellation.

Import as Skeletal

This import method imports the Alembic file as a Skeletal Mesh containing base poses as Morph Targets and blending between them to achieve the correct animation frame. Importing as a Skeletal Mesh is the most efficient way to play back an Alembic animation, as long as the vertex count does not change.

Import04_sk.png

During import, your animation sequence will be compressed using a PCA scheme, in which common poses (bases) are extracted and weighted to compose the original animation during playback time. When importing as a Skeletal Mesh, in addition to Sample, Normal Calculation and a Create Materials option you can also define the percentage (or fixed number of bases used) to tweak the level of compression.

Compression Options

Option

Description

Merge Meshes

Whether or not the individual meshes should be merged for compression purposes.

Bake Matrix Animation

Whether or not Matrix-only animation should be baked out as vertex animation (or skipped).

Base Calculation Type

Determines how the final number of bases that are stored as morph targets are calculated.

Option

Description

Percentage Based

Determines the number of bases that should be used with the given percentage (default option).

Fixed Number

Set a fixed number of bases to import.

Percentage (Max Number) of Total Bases

This will generate given (percentage or fixed number) of bases as morph targets.

This is one of the more important aspects for the level of compression. Entering a low amount of bases will make the animation more compressed but fine animation detail may be lost. Conversely, entering a high number of bases will result in less compression but will retain more animation detail.

Minimum Number Of Vertex Influence Percentage

Minimum percentage of influenced vertices required for a morph target to be valid.

This setting allows you to determine when a base/morph-target is imported based on your defined percentage of influence. For example, if we have a model with 1000 vertices and one of the bases only influences 10 vertices. If we were to set this value to 10, the aforementioned base/morph-target would not get imported.