XaiJu
jourverse
jourverse

patreon


Edit Landscape in C++

After a week of dedicated effort, I successfully developed a C++ function to deform or raise the landscape at a specific world location. This function is designed to procedurally adjust the terrain, making it suitable for our road network tool. The WorldLocation parameter defines the precise point in 3D space where the landscape modification takes place. An additional parameter, EdgeBlendFactor, ranges from 0 to 1 and determines the smoothness or blending at the edges of the modified area.

For those interested in technical details, the flat heightmap value is 32,768. Since a uint16 spans a range from 0 to 65,535, this value represents the midpoint. Furthermore, the engine's default landscape scale is set to 128.0f.
Code:
https://gist.github.com/sengchor/3712fdbe54ee8de29b0409d11e0ee267

Comments

This function is designed to work only in the editor and will not function at runtime. For runtime terrain deformation, you should use Runtime Virtual Textures (RVT) to create effects like mud or snow deformation or flatten hills city builder game. If you need more advanced modifications, such as digging trenches, creating hills, or carving caves, a custom voxel-based terrain system is a more powerful solution.

Sengchor Taing

Does this code function at runtime? I am looking for a way to have the player be able dig trenches or flatten hills for my city builder game.

acdodgen


More Creators