Programmatically creating a landscape from png

Hi everyone, Unreal Engine newb here but seasoned developer otherwise. I am trying to POC an idea I have and I want to take real world map that I have in png form and construct a level with it. I am not looking for anything fancy, it can be flat but my goal is convert certain pixel colors into different materials. I’ve tried a bunch of AIs but they all hallucinate, they give me non existent apis to use. Am I even going down the right path? I want an empty level that displays a large map which is in turn created by parsing that png (which so far, I’ve loaded into a texture). The png is about 6Kx5K in dimensions.

Thx

Hi @OuterWorldsPlay
Let’s see…

To convert your 6Kx5K PNG map into an UE level:

Load the PNG Texture: Import the PNG and import it into Unreal as a Texture2D asset.

Read Pixel Data: Read the pixel data (RGBA values) from the texture with FImage or FTexture2DMipMap in C++. This allows you to access the color information of each pixel.

Construct the Level: Spawn meshes or use materials based on the color of a pixel in the world. A tile can be represented by one pixel, and you can have color values for some materials or meshes.

Optimize: Since your texture is high-resolution, you could utilize a tilemap-like system or bunch pixels that are near each other together to reduce the amount of meshes created. You could utilize a landscape when performing terrain generation with heightmaps.

This should provide you with a general structure to create a flat map using materials from the pixel data

Thank you. I’ve already done the Loading & Reading. I am stuck in the construction. Is there more than one way of doing this? Sounds like a mesh approach or a materials approach?