Skip to content

Tutorials

Frozen Forest Reality Technologies edited this page Jul 20, 2026 · 1 revision

GSM_Description

Function Signature

UStaticMesh* UMeshOperationsBPLibrary::GSM_Description(FName Mesh_Name, const TArray<FVector>& Vertices, const TArray<int32>& Indices, const TArray<int32>& TriangleMaterialSlots, int32 NumMaterialSlots, const TArray<FVector>& Normals, const TArray<FVector>& Tangents, const TArray<FVector2D>& UVs, bool bSupportRayTracing

Meaning of Arguments

  • Vertices: shared vertex positions.
  • Indices: three vertex indices per triangle.
  • TriangleMaterialSlots: one material-slot index per triangle, or empty to use slot 0 for everything.
  • NumMaterialSlots: total number of polygon groups and static-material slots.
  • Normals: per-vertex normals; may be empty.
  • Tangents: per-vertex tangents; may be empty.
  • UVs: per-vertex UV coordinates; may be empty.
  • bSupportRayTracing: enables ray-tracing support on the generated mesh.

Single Material Example

TArray<FVector> Vertices =
{
    FVector(-100.0, -100.0, 0.0),
    FVector( 100.0, -100.0, 0.0),
    FVector( 100.0,  100.0, 0.0),
    FVector(-100.0,  100.0, 0.0)
};

TArray<int32> Indices =
{
    0, 1, 2,
    0, 2, 3
};

TArray<FVector> Normals =
{
    FVector::UpVector,
    FVector::UpVector,
    FVector::UpVector,
    FVector::UpVector
};

TArray<FVector> Tangents =
{
    FVector::ForwardVector,
    FVector::ForwardVector,
    FVector::ForwardVector,
    FVector::ForwardVector
};

TArray<FVector2D> UVs =
{
    FVector2D(0.0, 0.0),
    FVector2D(1.0, 0.0),
    FVector2D(1.0, 1.0),
    FVector2D(0.0, 1.0)
};

// Empty means every triangle uses slot 0.
const TArray<int32> TriangleMaterialSlots;
constexpr int32 NumMaterialSlots = 1;

UStaticMesh* StaticMesh = UMeshOperationsBPLibrary::GSM_Description(TEXT("RuntimePlane"), Vertices, Indices, TriangleMaterialSlots, NumMaterialSlots, Normals, Tangents, UVs, true);

Two Materials Example

TArray<int32> TriangleMaterialSlots =
{
    0,
    0,
    1,
    1
};

constexpr int32 NumMaterialSlots = 2;

Clone this wiki locally