Simplifying Static Meshes by Defeaturing

Describes how to increase rendering performance by removing small holes and protrusions from Static Mesh geometry.

Choose your operating system:

Windows

macOS

Linux

Defeaturing is a method of simplifying a mesh by removing protrusions and holes. This can increase rendering performance by decreasing the number of vertices and triangles the mesh contains.

defeaturing-banner.png

Defeaturing can be particularly useful for geometry that comes from computer-aided design (CAD) applications. When parts and assemblies are designed and modeled for the purpose of physical manufacturing, they are often created with small features that are essential for the real-world objects being manufactured, but not necessary for real-time rendering.

For example, this part from a fuel pump assembly contains 20,000 triangles. Removing some of the holes cuts that number almost in half. In this case, other parts in the assembly cover the modified areas, so the rendered result does not change noticeably when seen in context.

Before: 20,617 triangles

After: 11,553 triangles

In addition, if you plan to create Levels of Detail (LODs) to further simplify your mesh when it takes up less screen space, creating the LODs from a defeatured mesh can help to make the mesh simplification less apparent. For example, with this small part from a crankshaft assembly, the small holes look very jagged when seen at less-detailed LOD levels. By defeaturing to remove the small holes before creating the LODs, the mesh looks far cleaner when seen at smaller sizes.

Original mesh

LOD 2

Defeatured, then LODed

The Unreal Editor offers the ability to defeature any Static Mesh Asset that you've imported from Datasmith or FBX.

Removable Features

The following sections describe the types of features that the defeaturing tools can remove, and the measurements that you can supply to control the size of the features you want to remove.

Through Holes

Through holes are holes in a surface that pass entirely through an object and out the other side.

You can limit the size of the through holes you want to remove by specifying their maximum diameter.

Before removing through holes

After removing through holes

Blind Holes

Blind holes are holes in a surface that do not completely pass through the object. Instead, they have a bottom that is located at a certain depth from the surface.

You can limit the size of the blind holes you want to remove by specifying the maximum diameter of the hole, and the maximum depth of the hole below the surface. Only holes that are smaller in both dimensions will be removed.

Before removing blind holes

After removing blind holes

Protrusions

Protrusions are bumps that rise up above the surrounding surface.

You can limit the size of the protrusions you want to remove by specifying the maximum diameter of the protrusion, and the maximum height of the bump above the surface. Only protrusions that are smaller in both dimensions will be removed.

Before removing protrusions

After removing protrusions

Project Setup

In order to use Defeaturing, you must enable the Polygon Editing Plugin for your Project.

If you start from one of the Template Projects in the Architecture, Engineering, and Construction category, this Plugin may be enabled for you by default.

The Polygon Editing plugin is only supported on 64-bit Windows. In addition, Defeaturing is only available in pre-built binary distributions of Unreal Engine that you install through the Epic Games Launcher.

Defeaturing in the Static Mesh Editor

  1. Open the Static Mesh that you want to modify in the Static Mesh Editor.
    You can double-click the Asset in the Content Browser , or right-click it and choose Edit .

  2. Open the Mesh Editing Toolbar.
    Open the Mesh Editing Toolbar

  3. Click the Defeaturing icon.
    Defeaturing

  4. You'll see a settings dialog, where you can configure the features you want to remove:
    Defeaturing settings
    For each type of feature that you want to remove from your Static Mesh, check the corresponding option and set the maximum dimensions for that type of feature.

    Make sure to increase the maximum dimensions for each type of feature you select from their default values.

  5. Click Proceed to launch the defeaturing operation and modify the Static Mesh.
    Proceed

Defeaturing in Editor Scripts

You can remove through holes, blind holes, and protrusions in Blueprints and in Python.

Prerequisite: If you haven't already done so, you'll need to install the Editor Scripting Utilities Plugin . For details, see Scripting and Automating the Editor .

Choose your implementation method:

Blueprints

Python

You can run the defeaturing tools on a Static Mesh Asset in Blueprints using the Mesh Processing > Defeature Mesh node.

Defeature Mesh node

To use this node, your Blueprint class must be derived from an Editor-only class, such as the PlacedEditorUtilityBase class. For details, see Scripting the Editor using Blueprints .

You'll need to provide the following inputs for this node:

  • A reference to the Static Mesh Asset that you want to modify. This Asset has to be loaded first, typically by a call to the Editor Scripting > Asset > Load Asset node.

  • The index of the LOD that you want to modify on the Static Mesh. Use 0 unless you only want to defeature a specific LOD.

  • A MeshDefeaturingParameterObject that controls what types of features should be removed from the Static Mesh, and the maximum size of the features you want to remove.
    To set up one of these objects:

    1. Add a new variable to the Blueprint by clicking the + Variable button in the My Blueprint panel.

      Add variable

    2. Set the type of the variable to be a reference to a Mesh Defeaturing Parameter Object .

      Mesh Defeaturing Parameter Object

    3. Hold Control and drag the variable into the Blueprint graph to create a new node that gets the variable value.

      Drag and drop

    4. Drag right from the output port of the new variable node, and select from the Variables list the Set nodes for the settings that you need to modify.

      Defeaturing parameter API

For example, the following script removes all through holes from a Static Mesh Asset as long as they are less than 5 cm in width:

You can run the defeaturing tools on a Static Mesh Asset by calling the unreal.EditorMeshProcessing.defeature_mesh() function.

You'll need to pass this function:

  • The Static Mesh Asset that you want to modify. This Asset has to be loaded first, typically by a call to unreal.EditorAssetLibrary.load_asset() .

  • The index of the LOD that you want to modify on the Static Mesh. Use 0 unless you only want to defeature a specific LOD.

  • An unreal.MeshDefeaturingParameterObject that you create. Set up this object with the configuration parameters that control what types of features should be removed from the Static Mesh, and the maximum size of the features you want to remove.

For example, the following script removes all through holes, blind holes, and protrusions in the Static Mesh, provided that they are less than the dimensions set in the unreal.MeshDefeaturingParameterObject :

import unreal
asset_name = "/Game/Unreal_Sportbike/Geometries/0x25f0e0b7Unreal_Sportbike_geom_3180.Accumulator_case"
def defeature_mesh(mesh_name):
    # Load the Asset
    mesh_asset = unreal.EditorAssetLibrary.load_asset(mesh_name)
    # Create a parameter object
    options = unreal.MeshDefeaturingParameterObject()
    # Set up its properties
    options.fill_blind_holes = True
    options.filled_hole_max_diameter = 10
    options.filled_hole_max_depth = 5
    options.fill_through_holes = True
    options.through_hole_max_diameter = 10
    options.remove_protrusions = True
    options.protrusion_max_diameter = 10
    options.protrusion_max_height = 5
    # Run the defeaturing
    unreal.MeshProcessingLibrary.defeature_mesh(mesh_asset, 0, options)
    # Save the Asset
    unreal.EditorAssetLibrary.save_loaded_asset(mesh_asset)
defeature_mesh(asset_name)
Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss