C++ Terrain Manipulation and Generation


Lately I have been interested in PCG (Procedural Content Generation) and I’m amazed by beautifully generated playable terrains.

The part with the heightmap generation is understandable for me. The terrain application in Unreal is not.

My question is do you know how can I actually use C++/Blueprints to modify the terrain? Is it even possible? To access individual pixels of the terrain and set height to them?

I tried initially to read an image (imported in the engine) and read the pixels and map the rgb value from 0 to 1 and apply them to the vertices of the terrain. I failed miserably first at reading the pixels and second to access the terrain. I tried reading the code but it was a little daunting (to be honest I did not spend much time).

Has anyone tried something similar? Give any directions or tips? Maybe there’s a blog post that I could not find? I couldn’t find anything on the forums either?

It looks like that there is a BP component to generate procedural mesh and then access the vertices and modify them, but then I’m not sure that I will get all the benefits of the terrain class that is used normally. And to keep providing the sculpting/painting/vegetation tools.