Infinite world generation, mathematically generate heightmap at runtime

(Hi, I’m new to Unreal Engine 5).
I’m trying to create an “(nearly) infinite” world landscape by using world partition, but it seams to require a height-map file, which means that the world will be finite (or use terabytes of data, not acceptable).

I want to generate the height-map at runtime from a mathematical formula, in it’s simplest form each world-partition-point’s height would be: Height = sin( X )
Where X is that points X position in the world.

That would generate the landscape as a sine-curve along the X axis (“infinitely” wide in the other axis).
And as you see, this formula only needs a few bytes to become “infinite”, instead of a height-map that needs terabytes & still is finite.

But so far I have not found a way to generate a height-map like this at runtime, not with blueprints nor C++ code (should probably be possible, but I don’t know how yet).

Can someone more experienced point me towards what i need to learn? Tutorials? Wikis? Forums?..
Thanks!

To do an infinite landscape you need an alternative to the default Unreal Engine landscape.
There’s several options to do that, the voxel plugin for instance (there’s a free version).

I also shared a project i’m currently working on, available in this thread:

Allowing to generate infinite oceans and landscapes from the shader editor.

Here i did the sin(X) you just suggested:

2 Likes

Nice, that Sin-wave landscape was exactly what I expected :smiley:
Nice to know that it can be done, I guess I need to learn more about the (visual) scripting system and how to connect it to the world generation somehow.
Nice that you showed that it could move in real-time too, so it’s not some weird issue to generate changing terrain.
I will have a look at your project too.

1 Like

In my project ground collision are relevant only if it’s not moving, the movement is originally to do oceans.