Download

Procedural Landscape from Shader Graph w/ Geometry Clipmaps BP/C++ | Download

9/24 : Released as a 4.26/4.27 plugin available on marketplace!:

In this project you can generate either an ocean, or a landscape, using all the tools you have in the shader editor.The landscape generation is within a simple material function, you have an input world location and are free to do whatever you want to ouput a height signal : ideally normalized, allowing to control the height amount using the associated material collection directly.Once the landscape generation part is done, you can build your landscape material on top of it as you would with any landscape.

There’s an asset spawning system computed using the shader editor as well. You can chose to spawn instanced meshes, or any actors, leveraging the landscape layer system or any procedural spawn settings you might have in mind.

As you can use this solution to generate a dynamic ocean changing over time or a ‘static’ terrain that doesn’t need to be computed every frame, there’s a ‘caching’ option within the detail panel. Disabling caching is also convenient for instant feedback while testing ideas to generate your terrain, but you’ll want to turn caching back on for a drastic performance boost.

9/7/2021 Caching Finish + Triplanar example

I removed all the link to download previous version, there’s only github and google drive files named “ProceduralLandscapeFromShader_v00”.
No more cracks in the terrain if using the cache. Now that the cache is working as intended the next big step is improving the asset spawning and adding compatibility with the engine Procedural foliage system.
But i’ll port the v0 to UE 4.26/4.27 before that.

9/6/2021 Caching !

Prevent recomputing the whole landscape each frame… !
Dont forget to turn it off for instant feedback when editing the shader graph. The spawning of assets is also in shader graph and needs to be completed for random yaw/align to normal… !

9/5/2021 update Spawnables !

9/4/2021 update

Here it is !

Within the project there’s an implementation of the GPU Gem 2 Improved Perlin Noise (used for the mountains demo)

Could be used in a lot of ways :smiley:

9/3/2121 update

With runtime collision generation near the viewer this time. Uploading the file next weekend.

8/31/2021 update
Added a c++ implementation and hopefully made some logic improvements. Also added the LOD stitching and a warped improved perlin noise:

Was wondering if you could run a good old CPU based clipmap on blueprints, ended up implementing it today and sharing it here.
Fair warning, i am not a BP artist regarding organizing the spagheties!

In the end it could be turn to C++ and use for a landscape solution. Thought it could be relevant learning material.

11 Likes

Updated with new video, cleaning up the updated project and uploading now !
Further work could include adding collision and its data structure as well as various spawnables, more noises variations and blending…
I don’t have any more time to spend on this so sharing it here for anyone to have a look at how i put this together.

3 Likes

I downloaded the file and it is the Infinite Ocean - How do I get the landscape version ?

1 Like

Made the video last night, need to do a couple minutes of cleaning on the project and i’ll upload it then. most likely later today (central europe time)

1 Like

Oh ok thanks very much

Been busy, i’ll upload it this weekend

2 Likes

There were no collision at all in previous video. Here i’m generating collision near the viewer at runtime.
Cleaning it up and sharing in the linked thread in description!
I’m ‘hacking’ the visibility culling, otherwise the landscape would be culled near the viewer, it impact the performance severely but to fix it properly would require a custom mesh component which i have no intend to dive into for this project!

1 Like

Uploaded the project and added a video. Let me know if you encounter any issue.
In doubt hit ‘rebuild’ in the geoclipmap actor detail panel.
Biggest limitation for now is the hacked geometry culling which tends to tank performance.

2 Likes

Within the project there’s an implementation of the GPU Gem 2 Improved Perlin Noise (used for the mountains demo)

Could be used in a lot of ways :smiley:

2 Likes

Today i added spawnable meshes, also compute on the gpu, goal is to have as many spawning options as the procedural foliage system from unreal, but for now there’s only the slope constraint working. (If ground normal is within A-B range you can spawn).

Still need to add the ‘align to normal’ shader logic, as everything is pointing up for now. The code part is done, so it’s purely the shader logic to implement, you can even figure it out yourself.

Added the project on github :

Added Cache support, so you’re not recomputing the landscape every frame… !

There’s still an issue with it, with some gaps appearing between LOD ‘sometimes’, that i need to figure out.

2 Likes

You have to use the world position to generate uv for your textures: you grab the world position, take the XY coordinates and divide by 500, and get a 5x5 meters UV for your texture.

1 Like

Thank you so much for this. It isgreat fun

1 Like

No more cracks appearing in the terrain while using cache, so it’s perfectly working. I added a triplanar mapping example and called it a day.
Guess i’ll make this project available on UE4.26 and 4.27 for now.

2 Likes

interesting! and very nice that you’re sharing it :slight_smile:

how does it compare to regular Landscape in terms of performance? I’m curious if it could be used as a replacement for Landscape for rendering (keeping Landscape toolset and pipeline but just converting to your GeoClipMap as a last step)

3 Likes

UE landscape is battle tested with a ton of features, i was actually thinking of the other way around:
Either you require the infinite/runtime procedural based aspect or you use it just to experiment and generate your world, which you can then export to the UE landscape system as tiled heightmaps.

4 Likes

2 Likes

Made some improvements, and found a bug that i fixed in vertex normal generation.
Also made the spawning system relying on the cached data, which makes the asset spawning shader complexity going from 800 instructions to 250 ( not sure how accurate it is when custom nodes are used tho)

Will update with a reference landscape material soonish.

1 Like

Being able to export the generated heightmaps would be great. I want to walk through this system very soon. Thank you again for sharing it.

1 Like