Open Phyronnaz opened 4 years ago
+1 this would be very useful for some projects Thanks !
Hi @Phyronnaz
Could you give us some clue on the best practice to implement this?
We are going to implement this in our project.
Assuming you are using the RGB material config (other configs are similar), and that you loaded the image using the unreal ImageWrapper stuff already into TextureData
:
auto* HeightmapAsset = NewObject<UVoxelHeightmapAssetUINT16>();
auto& HeightmapData = HeightmapAsset->GetData();
HeightmapData.SetSize(Width, Height, true, EVoxelMaterialConfig::RGB);
for (int32 X = 0; X < Width; X++)
{
for (int32 Y = 0; Y < Height; Y++)
{
const int32 Index = X + Width * Y;
HeightmapData.SetHeight(X, Y, TextureData[Index])
HeightmapData.SetMaterial_RGB(X, Y, MyColor);
}
}
Then use HeightmapAsset
as world generator object.
Let me know if you need more info @chaiyuntian
@Phyronnaz Thank you so much! I will try it.
Hello, Could it be possible to import heightmaps at runtime ? Thanks :-) Cedric