Converters

converters
Decide your desired output format with the converter classes
Converter Types
 
The converter types will decide what is the output of your mesh, one geometry node can have one output type, you can edit the configuration of the output in the details panel of the actor.
 
If you want to save the configuration of a specific converter type, you can create a new blueprint inheriting from a certain type. For example, you may always want to use the merge materials option on the Static Mesh Converter, for this, you can subclass the Static Mesh Converter to create your own preset.


Convert to Static Mesh
This is the default converter, upon saving the map, your mesh will become a Static Mesh, this converter also takes care of instancing
Convert to Foliage
This converter will first convert your mesh to a Static Mesh, and then place the meshes on Unreal’s foliage system, you can use the foliage editor to move, add or remove instances. You can revert the edits to the foliage instances by refreshing the actor.
Convert to Vertex Animation Textures (VAT)
This converter will create a texture containing the animation information of your geometry nodes, you can change the initial and final frame of the animation in the details panel of the actor.
Do not convert
This option will not allow the output mesh to be saved, useful if you don’t need a Static Mesh to be created, and will instead rely on having the object updating at runtime, eg. for cinematics
Creating new converters
You can create new converters (C++) if you need different output types, in this example, we will create a converter that saves the bouding box of the resulting GN output
This is an advanced feature
				
					UCLASS(BlueprintType, Blueprintable, meta=(DisplayName="Converter Example:
Convert to Bounding box"))
class UAlterMeshExamplesConverterBoundingBox : public
UAlterMeshConverterBase
{
GENERATED_BODY()
public:
UAlterMeshExamplesConverterBoundingBox();
// Properties added here will be prompted for user input
UPROPERTY(EditAnywhere)
UMaterialInterface* Material;
virtual void Convert(AAlterMeshActor* InActor) override;
};
				
			
				
					void UAlterMeshExamplesConverterBoundingBox::Convert(AAlterMeshActor*
InActor)
{
// If you inherited from UAlterMeshConverterStaticMesh call this to create
the StaticMesh assets
// Super::Convert(InActor);
// And this would contain your newly created meshes, or the replacement
meshes/blueprints
// ConverterSteps[i].AssetToUse
FBox Bounds;
// Find the bounds of all meshes and all instances
ForEachSection(InActor, [&](FAlterMeshSection& Section)
{
FBox MeshBounds = FBox(Section.Vertices);
for (FMatrix InstanceMatrix : Section.Instances)
{
Bounds += MeshBounds.TransformBy(InstanceMatrix);
}
});
FActorSpawnParameters SpawnInfo;
SpawnInfo.OverrideLevel = InActor->GetLevel();
SpawnInfo.SpawnCollisionHandlingOverride =
ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
SpawnInfo.bNoFail = true;
// Proc mesh to display bounds
AActor* NewActor = InActor->GetWorld()->SpawnActor<AActor>(SpawnInfo);
UProceduralMeshComponent* ProcMesh =
NewObject<UProceduralMeshComponent>(NewActor);
NewActor->SetRootComponent(ProcMesh);
NewActor->AddInstanceComponent(ProcMesh);
ProcMesh->RegisterComponent();
NewActor->SetActorTransform(InActor->GetActorTransform());
if (Material)
{
ProcMesh->SetMaterial(0, Material);
}
// Create a cube from bounds
TArray<FVector> Vertices;
TArray<int32> Indices;
UAlterMeshExamplesLibrary::MakeCubeFromBox(Bounds, Vertices, Indices);
TArray<FVector> Normals;
TArray<FVector2D> UVs;
TArray<FColor> Colors;
TArray<FProcMeshTangent> Tangents;
ProcMesh->CreateMeshSection(0, Vertices, Indices, Normals, UVs, Colors,
Tangents, false);
}
				
			

Need more help?