Download

ProceduralMeshComponent created at runtime does not render

Hey there!

I’ve been searching for two days through the couple of tutorials there are for Procedural Meshes - the closest I got was a couple of recommendations for RuntimeMeshComponent, which unfortunately doesn’t work with UE5 (I almost got it to compile, but TesselatedRendering seems to be gone in UE5)

Anyways, here’s my issue:

I have a pretty barebones Actor with a single ProceduralMeshComponent (initialized and attached in constructor). On initialization, it creates a simple GridMesh with UKismetProceduralMeshLibrary::CreateGridMeshWelded() and creates Section 0 of the PMC.

It has a BlueprintCallable function to destroy itself and spawn 4 smaller actors of itself (I’m building a quadtree LOD system)

This - the initial constructor and the splitting function - work fine in the editor.

Any actors spawned at runtime however show up in the world outliner but don’t render.

I’ve tried setting visibility, updating the mesh section, re-registering the component, nothing works. Maybe I need to recreate the Scene Proxy, but I couldn’t get that to work.

Here’s the relevant code:

constructor
{
	ProcMeshComp = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("Procedural Mesh"));
	RootComponent = ProcMeshComp;
}

InitMesh() {
  UKismetProceduralMeshLibrary::CreateGridMeshWelded(...);
  ProcMeshComp->UpdateMeshSection_LinearColor(...)
}

UFUNCTION(CallInEditor)
Split() {
  ProcMeshComp->ClearAllMeshSections();
	Destroy();

	ATerrainChunk* Chunk1 = GetWorld()->SpawnActor<ATerrainChunk>();
	Chunk1->InitMesh(...);
}

In Editor: Before Split → After Split


Runtime: After Split

1 Like

I want to help you with that, let’s figure it out. Do you have a test project. Which version of the engine are you on ?
Github version of early access version?
You want to make some basic terrain setup?

1 Like

You should try prototyping in blueprint and instead of spawning actors, just add proceduralmesh component to your initial actor for now ?

Made a simple subdivision demo in blueprint:

1 Like

Hey Maxime,

Thanks for the answer! I’ll look into your video and compare.

I’ll try setting up an actor BP with PMC and initialize it there, then spawn it during gameplay and see if it renders.

I’m on 5.0EA - precompiled version through the Epic Games launcher.
Here’s the uproject, solution file and Source folder:
ProcPlanet.zip (8.5 KB)

1 Like

Quick update - a simple actor BP with procmeshcomponent, spawned at runtime, works. Then I’ve probably borked something with the spawning :slight_smile:

1 Like

Implemented Geometry Clipmaps in blueprint today. Might be an interesting approach to look into if you wanna make a landscape/planet.
Reimplementing it in C++ would allow to add collisions, spawnables etc… a true landscape alternative if you want.

GeometryClipmapBP.zip (1.9 MB)