Mesh Tools
The RealtimeMeshComponent ships a set of tools for getting geometry into and out of a
RealtimeMesh, and for cleaning that geometry up before you render it. These are the utilities you
reach for when the mesh data doesn’t originate from your own generator: files on disk, existing
UStaticMesh assets, the GeometryScript UDynamicMesh, or a UProceduralMeshComponent you’re
migrating away from.
Almost everything on these pages lives in the RealtimeMeshExt module (the OBJ loader, the
StaticMesh and DynamicMesh converters, and the data optimizer). To use any of them from C++, add
RealtimeMeshExt to your module’s Build.cs:
PublicDependencyModuleNames.AddRange(new[]{ "RealtimeMeshComponent", "RealtimeMeshExt", // OBJ loader, converters, optimizer});The URealtimeMeshProcedural drop-in component and its helper library live in the core
RealtimeMeshComponent module instead — that difference is called out where it matters below.
The common currency: FRealtimeMeshStreamSet
Section titled “The common currency: FRealtimeMeshStreamSet”Every tool here speaks in terms of a FRealtimeMeshStreamSet (or its UObject wrapper
URealtimeMeshStreamSet on the Blueprint side). A stream set is just the collection of raw vertex
and index buffers — position, tangents, texcoords, colors, triangles, poly groups. It is not yet
a renderable mesh.
The pattern is always the same:
- Fill a stream set — from a file, a converter, or your own builder.
- (Optional) Optimize it in place — see Mesh Optimization.
- Hand it to a mesh —
URealtimeMeshSimple::CreateBufferSet(GroupKey, MoveTemp(StreamSet)).
Because the stream set is plain CPU data, steps 1 and 2 can run on a worker thread; only the final
CreateBufferSet needs the game thread. See Key Concepts for the stream
set and builder fundamentals.
What’s here
Section titled “What’s here”- Loading Meshes — Load OBJ files at runtime (sync or async) with
URealtimeMeshObjLoader, and the general recipe for wiring any other file format into a stream set. - Converting Static Meshes — Copy geometry between a
UStaticMeshasset and a RealtimeMesh in either direction withURealtimeMeshStaticMeshConverter. - Converting Dynamic Meshes — One-shot conversion to and from
GeometryScript’s
UDynamicMeshwithURealtimeMeshDynamicMeshConverter, plus how RMC relates toUProceduralMeshComponent. - Mesh Optimization — Reindex, cache-optimize, reduce overdraw, and
improve vertex fetch with the meshoptimizer-backed
URealtimeMeshDataOptimizer.
Related
Section titled “Related”For meshes whose source is another live mesh that you want to keep mirrored automatically (rather than converted once), see the mesh types:
- RealtimeMeshDynamic — a RealtimeMesh that continuously
mirrors a
UDynamicMesh. - RealtimeMeshProcedural — a drop-in replacement for
UProceduralMeshComponentwith the same Blueprint surface.