UDN
Search public documentation

MeshSimplificationTool
Licensees can log in.

Red links require licensee log in.

Interested in the Unreal engine?
Check out the licensing page.

Questions about UDN itself?
Contact the UDN Staff

Mesh Simplification Tool

Document Summary: User's guide for the Unreal Editor's Mesh Simplification Tool.

Document Changelog: Created by Mike Fricker.

Overview

The Mesh Simplification Tool allows you to reduce the geometric complexity of static mesh assets on a per-level basis. It can create a simplified copy of a mesh by parametrically reducing the triangle count, and then storing the mesh inside your level's package. It can also replace references to a high resolution mesh for all actors in the level, and help to maintain the simplified meshes over time.

In short, a level designer can use this tool to quickly reduce a map's memory footprint and improve render times, with some trade-off in visual quality.

How It Works

Typically you have a static mesh asset that's used in several levels. While you're working on one of these levels you might find that your use-case for this mesh doesn't require quite so much geometric detail. Or, maybe your map is just too slow (or using too much memory) and you need to get it faster.

The Mesh Simplification tool lets you create a lower-resolution copy of the original mesh, unique to that level. You can tweak the triangle count of the new simplified mesh and view the changes in your level on-the-fly. This new simplified mesh will be stored right inside the level's package file. Also, the tool will take care of updating all of the actors in the map that reference that mesh.

Your changes will only affect the map you're working on. You can repeat this process for any static meshes used in the map that you think would benefit. Afterwards you should see a reduction in memory usage, and possibly an improved frame rate, too!

Here is a diagram that shows the before and after of this process:

MeshSimpFlow.jpg

Note: Currently, only plain static meshes are supported. Skeletal meshes and fractured static meshes may be supported in the future.

Using the Mesh Simplification Tool

This tool is really easy to use! The following sections will guide you through the mesh simplification process from start to finish.

Summoning the Tool Window

There are a few ways to bring up the Mesh Simplification window:

You can right-click on any static mesh actor in your level and choose Simplify Mesh for Level.... This is the most common way to summon the tool. You can open the generic browser and navigate to a static mesh, then right-click on it and choose Simplify Mesh for Level....
MeshSimp_SummonViewport.jpg MeshSimp_SummonGB.jpg

Or, you can also get to the tool through the Window menu in the Static Mesh Editor?.

After opening the Mesh Simplification tool, you should see something like this:

MeshSimp_InitialView.jpg

The Mesh Simplification tool is built into the Static Mesh Editor window as a freely dockable tool window. While working with the Mesh Simplification tool, your window layout settings for the Static Mesh Editor will be stored separately, so feel free to rearrange things however you'd like.

Simplifying a Mesh

After opening the tool, you can see that the mesh you selected for simplification is displayed as the High Resolution Mesh near the top of the window. Along with the object name and package, the mesh's triangle and vertex count are shown here. Additionally, the number of actors in your level that reference this mesh are shown. If you want to know exactly which actors are referencing the mesh you can click the Details... button next to the actor count.

MeshSimp_HighResMeshInfo.jpg

You'll want to choose a triangle count for the simplified mesh you're about to generate. Use the Target Triangles slider in the middle of the tool for this. The slider's range is between one and the number of triangles in the high resolution source model, but the effective range is always a bit smaller. This is because of border edges, UV seams, hard edges, etc, which must be preserved while degrading the model's complexity.

MeshSimp_TargetTriangles.jpg

Okay, now you're ready to simplify the mesh! Click Create New Simplified Mesh. A message box will let you know what's going on and you'll be prompted to continue. Choose Yes.

MeshSimp_CreatePrompt.jpg

Finally you'll be prompted for a name and package for the new simplified mesh. Usually you can just accept the defaults by pressing OK, and the simplification mesh will be created!

MeshSimp_PackageAndNamePrompt.jpg

Alright! After a second or two of work, the tool well let you know if everything went well:

MeshSimp_CreatedOK.jpg

For very large models, it's possible for the simplification process to take longer than a few seconds. Generally, the lower the triangle count you select, the faster the mesh rebuild process will complete. Afterwards, the Static Mesh Editor will switch to viewing the new simplified mesh, and you can see results on your model's geometry in the viewport window:

MeshSimp_Results.jpg

Statistics for the new simplified mesh will be displayed at the bottom of the tool window. Note that, for various reasons, the simplified mesh's triangle count usually won't match the target triangle count you specified. The percentage values represent the triangle and vertex counts of the simplified mesh compared to the high res mesh.

MeshSimp_SimplifiedMeshInfo.jpg

Assigning the Simplified Mesh to Actors

You've created a new simplified static mesh in your level's package. However, the actors in your scene are still referencing the original high resolution mesh.

Near the bottom of the Mesh Simplification tool window, you'll see a button named Assign Simplified Mesh to Actors. Clicking this will replace references to the high res mesh on all actors in the 'current' level with the newly-created simplified mesh. The button will be disabled if no actors in your scene are referencing the high res mesh yet.

MeshSimp_AssignSimpToActors.jpg

All of the appropriate actors in your level should now be using the simplified version of the mesh. Also, the changes will be reflected immediately in your level viewport windows.

You've done! If you want to learn about making further adjustments to your mesh, read on.

Updating a Simplified Mesh

Now, you can tweak the quality of the simplified model by adjusting the Target Triangles slider and clicking Update Existing Simplified Mesh. The mesh will be updated immediately and you'll see the results in the level viewports.

MeshSimp_UpdateExisting.jpg

The simplified mesh will remember the high resolution mesh it was created from. This makes it easy to make changes to your simplified mesh later on. Also, you might want to refresh it after the high resolution mesh has undergone changes. The editor keeps track of relationships between a simplified mesh and it's high res source mesh to make it easier to maintain these assets.

If you right click over a static mesh actor in your level that's bound to a mesh that's already been simplified with this tool, you'll see an option called Resimplify Mesh....

MeshSimp_ResimplifyMeshInViewport.jpg

Selecting this option will bring you straight into the Mesh Simplification tool where you can easily make changes to your model's triangle count.

Other Features

Map Check

The editor's Map Check feature can detect certain problems with simplified meshes in your level. You can run the Map Check utility at any time using the Tools -> Check Map for Errors command in the editor's main menu.

MeshSimp_MapCheck.jpg

Currently, the following conditions are checked:

  • If the high resolution source mesh has been modified since the simplified mesh was created, a warning will be displayed.
  • If the editor cannot find the high resolution source mesh associated with a simplified mesh, a warning will be displayed.

You can use the Go To button in the Map Check window to jump directly to that actor, then right-click and select Resimplify Mesh... to address the problem.

Restoring Actor References

If you want to stop using the simplified mesh in your level, you can easily restore references to static mesh actors in your scene to point to the high resolution mesh. This is accomplished using the Restore High Res Mesh to Actors button near the top of the tool window:

MeshSimp_RestoreHighResMesh.jpg

All static mesh actors in the current level that were referencing the simplified mesh should now be using the original high res source mesh. The changes will take effect immediately in the level viewports.

Propagating Mesh Changes

If an artist makes a significant change to the high res source mesh after you've created simplified copies of the mesh into various level packages, you'll probably want to update those simplified meshes.

  • To do this, load up a level that contains a simplified mesh that was spawned from the modified high res source mesh.
  • Locate an actor using that mesh in a viewport and right-click on it.
  • Select Resimplify Mesh...
  • You may be presented with a warning message about the high res mesh appearing to have changed since the last time the simplified mesh was updated. If so, just click OK to dismiss that. We'll repair it right now!
  • Select a triangle count for the simplified mesh. The current setting will match the existing simplified mesh's triangle count, which is probably sufficient.
  • Click Update Existing Simplified Mesh. This will rebuild the simplified mesh using the new source data in the high res mesh.
  • Make sure you're happy with how the simplified mesh looks -- make any appropriate adjustments to the triangle count and update as necessary.
  • You'll need to repeat these steps for each affected high res model, and for each level that an affected simplified mesh copy exists in.

Renaming or Deleting Source Meshes

If a high resolution mesh is renamed after a simplified copy has been created, the engine's object redirector system will handle this in the short term. The next time that the FixUpRedirects tool is run, the simplified mesh's soft reference to the high res mesh should be updated automatically.

If the high resolution mesh is deleted entirely, then you can expect to receive a warning about this, both in the Map Check window and also when summoning the Mesh Simplification tool for the associated simplified mesh. Currently, there are only a few ways to repair this warning:

  • Option 1: Open the Mesh Simplification tool for the simplified mesh that's associated with the deleted high res mesh. You'll be prompted with a warning about this, and then you'll be asked if you want to Unbind from the high res mesh entirely. If you choose Yes, the simplified mesh will become a stand-alone mesh in the level's package and the Mesh Simplification tool features will no longer be available.

  • Option 2: Create a new high res mesh that's named the same as the deleted mesh and make sure to place it in the same package that the deleted mesh was in. This will eliminate the warning. Now, open the Mesh Simplification tool for the simplified mesh and use Update Existing Simplified Mesh to refresh the visuals.

Note: If you choose to Unbind the simplifed mesh from it's high res source mesh, you won't be able to rebind it again later. Be careful -- this is a one-way operation!

Additional Information

Reducing Level Memory Usage

This tool was designed first and foremost to reduce the amount of memory used by a level. Frame rate improvements were also a goal, but less so.

To achieve this, it's important that all static mesh actors in a level that reference an asset are updated to use the simplified copy that was created in the level's package. Otherwise, you'd have actors referencing both meshes and your memory usage would actually increase. While you can use the tool to create a simplified mesh that's used alongside the high resolution mesh in a level, this is not really recommended, and the tool won't be helpful in preserving the actor's mesh references this way.

Similarly, you probably don't want to go creating multiple simplified copies of a mesh and embedding them into your level, unless you feel the memory trade-off is really worth the (likely small) performance gain in geometry throughput.

Simplification Algorithm

We currently use Microsoft's D3DX utility library to reduce the complexity of the mesh. This algorithm works pretty good in general. It will try to preserve border edges, UV seams and normal seams and will usually remove the triangles that you'll miss the least.

It can sometimes make a mess of quad edge windings and general mesh tessellation, so watch out for lighting artifacts, especially on per-vertex light mapped meshes.

The algorithm itself supports weighting the simplification on a per-vertex basis, but we don't expose that feature yet in the editor.

Soft Reference to High Res Mesh

After creating a simplified mesh, it will retain a soft reference of sorts to the high resolution source mesh. This isn't a traditional Unreal object reference -- it won't cause the high res mesh to be loaded in game or included during the cooking phase. It's really just a string reference to the name and package of the source mesh.

This allows the editor to assist the user in keeping the two meshes in sync more easily without incurring any real performance overhead.

Simplifying Meshes for Multiple Levels

When simplifying a mesh, the new mesh will always be created in the Current Level's package by default.

If you have a lot of streaming levels that you want to use the simplified mesh in, consider creating a separate simplified copy for each of the streaming levels. You can do this easily by using the Level Browser to change the Current Level. When the Current Level changes, the Mesh Simplification tool automatically refreshes it's interface, so you can go ahead and create additional simplified meshes from a single high res source mesh.

Just keep in mind that all of the actions in the Mesh Simplification tool window (e.g. assigning meshes to actors) apply only to the Current Level in the Level Browser, not all loaded/visible levels.