Materials — Dynamic Floor Plugin
Materials
This page explains how the material system works in the Dynamic Floor Plugin and how to set up your own material assignments.
How materials work
The plugin uses an integer ID system for materials. Each floor polygon stores a MaterialId (an int32 value) rather than a direct reference to a UMaterialInterface.
Why integer IDs?
From the official documentation:
“Materials in this Plugin are assigned over IDs — The thought behind this is, that maybe later users are able to like upload own materials/textures you name it. Then it must be a mechanism to get the surface data from anywhere where you store it right. So imagine a huge Sims game. Every user contributing textures or something. You get like millions of surfaces. So an ID-Surface data relation will be essential.”
This design allows materials to be stored in an external system (a database, a web service, user-generated content) and resolved at runtime — not hard-coded as asset references.
The SimpleMaterialManager
The plugin includes a SimpleMaterialManager Blueprint. Its job is to map MaterialId integers to actual UMaterialInterface objects at runtime.
The official documentation notes:
“So I created a ‘SimpleMaterialManager’ to be able to dynamically assign a lot of materials over IDs. That we have to create too. […] So any BP you make just needs to implement an interface and can be used here.”
This means you can replace SimpleMaterialManager entirely with your own implementation as long as it implements the expected interface.
Assigning a material during placement
When spawning the placement tool via your HUD, you pass the FloorMaterial (integer ID) as a parameter:
PlaceFloor(FloorType, FloorMaterial)This ID is carried through the entire pipeline:
PlaceFloor(FloorType=Default, FloorMaterial=3) → FFloorInputEvent.MaterialId = 3 → UPolygonDatabase.AddPolygon(..., MaterialId=3, ...) → FFloorPolygon.MaterialId = 3 → BP_FloorPolygonRenderer groups polygons by MaterialId → SimpleMaterialManager resolves MaterialId=3 → UMaterialInterface → assigned to the corresponding ProceduralMesh sectionPer-polygon material data (FFloorPolygon)
Every polygon in the database includes:
| Field | Type | Description |
|---|---|---|
MaterialId | int32 | The integer material identifier |
FloorType | EFloorType | The logical layer type |
Floor Types and material rendering
EFloorType provides an additional layer of separation on top of MaterialId:
| Value | Typical use |
|---|---|
Default | Visible floor surfaces |
Border | Wall boundary polygons (may be invisible or use a separate material) |
Invisible | Logical-only polygons — no visible mesh |
The renderer (BP_FloorPolygonRenderer) can group and filter by both MaterialId and FloorType.
Use UPolygonDatabase.GetPolygonsInBoxFiltered(Box, MaterialId, FloorType, HeightLevel) to query polygons by specific material and type.
How the renderer uses material IDs
BP_FloorPolygonRenderer maintains one ProceduralMesh section per MaterialId. When OnAllPolygonsTransferred fires:
- It collects all polygons that have received changes (marked dirty by
OnPolygonAdded/OnPolygonRemoved). - For each dirty
MaterialId, it regenerates the full mesh section. - It calls
SimpleMaterialManager(or your equivalent) to resolve theMaterialIdto aUMaterialInterface. - The material is applied to the mesh section.
Querying polygons by material
Get Polygon Database → GetPolygonsInBoxFiltered( Box = your area, MaterialIdFilter = 3, FloorTypeFilter = Default, HeightLevel = 0.0)Returns all floor polygons in the specified area with the given material and type.
See also
- Floor Placement — how
MaterialIdis set during placement - Features — material system overview
- Build Mode — passing material selection from the HUD