Runtime Mesh Simplifier

RMS is a UE4 tool that allows you to quickly simplify meshes at runtime.

Welcome to the documentation and thank you for purchasing Runtime Mesh Simplifier!

For any questions, don’t hesitate to contact me at: help@leastsquares.io

Please consider rating the package in your asset downloads or leave a review on the asset page. This will help the growth of this asset.

Getting Started

Setup

The main component of the plugin is MeshSimplifierLibrary function library. It exposes a group of functions that provide the user with ways of simplifying static meshes, procedural meshes and group of vertices at runtime, these are better described on the C++ Function/Blueprint Reference section.

There are 2 main ways to use the plugin:

  • Creating a LOD of a static mesh: Runtime Mesh Simplifier allows you to create lower detailed versions of your static models at runtime. This can be done easily by calling the CreateLODMeshfunction and providing a reference to the static mesh component we wish to change, a float that represents the target quality and a float that represents the target error the simplifier should use. With this information the function will extract the mesh data from the static mesh (Please make sure the option Allow CPU Access on the mesh is enabled) and create a lower detailed version. The function will hide the static mesh component and add a child ProceduralMeshComponent to it that shows the simplified mesh.

  • Simplifying a mesh: The plugin also allows the user to simplify any group of indices & vertices or mesh data. This can be done by calling on of the 3 available functions SimplifyIndices, SimplifyProceduralMesh or SimplifyStaticMesh.

In all function the Quality parameter is a float that represents the percentage of the original triangles that we want to have. The target error represents the max error the algorithm can use. A higher error will give better simplification results at the cost of a loss in topology quality and vice-versa.

All of the exposed functions also have blueprint nodes available at the LeastSquares|MeshSimplification category.

C++ Function/Blueprint Reference

SimplifyIndices

static void SimplifyIndices(TArray<int32> Indices, TArray<FVector> Vertices, TArray<int32>& NewIndices, float Quality, float TargetError = 0.05f);

Simplifies a mesh from an array of indices and vertices and returns the new indices

SimplifyProceduralMesh

static void SimplifyProceduralMesh(UProceduralMeshComponent* ProceduralMeshComponent, float Quality, float TargetError = 0.05f);

Simplifies a procedural mesh and and stores the result on the same mesh.

SimplifyStaticMesh

static void SimplifyStaticMesh(UStaticMesh* StaticMesh, TArray<UMaterialInterface*> Materials, UProceduralMeshComponent* ProceduralMeshComponent, float Quality, float TargetError = 0.05f);

Simplifies a given static mesh and sets the simplification on a procedural mesh component. The mesh used needs to have Allow CPU Access enabled.

CreateLODMesh

static void CreateLODMesh(UStaticMeshComponent* MeshComponent, float Quality, float TargetError = 0.05f);

Updates the object to show a simplified version of the mesh stored in the static mesh component provided. This is done by hiding the static mesh component and showing a newly created procedural mesh component that is stored as a child of the static mesh component. If the quality parameter is 1 nothing is done and the original mesh is done. The static mesh used needs to have Allow CPU Access enabled.

Troubleshooting

SimplifyStaticMesh and CreateLODMesh do nothing or crash in a packaged build.

Please make sure the meshes you are trying to simplify have the Allow CPU Access enabled. Otherwise the plugin won’t be able to retrieve the necessary information it uses to reconstruct the mesh.

Other issues

If you couldn’t fix your issue don’t hesitate to shoot me an email at: bytesizedassets@gmail.com



About us

We are a small company focused on building tools for game developers. Send us an email to careers@leastsquares.io if interested in working with us. For any other inquiries, feel free to contact us at hello@leastsquares.io or contact us on the discord





Sign up to our newsletter.

Want to receive news about discounts, new products and updates?