# Programmatically creating a landscape from png 

**URL:** <https://forums.unrealengine.com/t/programmatically-creating-a-landscape-from-png/2414222>\
**Category:** World Creation\
**Tags:** unreal-engine, Landscape, Rendering, question, CPP\
**Created:** [March 24, 2025, 5:28pm UTC](https://forums.unrealengine.com/t/programmatically-creating-a-landscape-from-png/2414222 "2025-03-24T17:28:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![OuterWorldsPlay](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OuterWorldsPlay](https://forums.unrealengine.com/u/OuterWorldsPlay)\
**Post date:** [March 24, 2025, 5:28pm UTC](https://forums.unrealengine.com/t/programmatically-creating-a-landscape-from-png/2414222/1 "2025-03-24T17:28:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BRS\_GerDAngelo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brs_gerdangelo/32/1009628_2.png) [@BRS\_GerDAngelo](https://forums.unrealengine.com/u/BRS_GerDAngelo)\
**Post date:** [March 24, 2025, 6:10pm UTC](https://forums.unrealengine.com/t/programmatically-creating-a-landscape-from-png/2414222/2 "2025-03-24T18:10:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![OuterWorldsPlay](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OuterWorldsPlay](https://forums.unrealengine.com/u/OuterWorldsPlay)\
**Post date:** [March 24, 2025, 6:19pm UTC](https://forums.unrealengine.com/t/programmatically-creating-a-landscape-from-png/2414222/3 "2025-03-24T18:19:17Z")

</div>

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?
