Download

The Eden Project

I’ve been playing around with some ideas I’ve had (for a very long time) about generating planet sized terrains for an open universe sci fi game.

I’ve managed to get a couple of very basic things going, so I thought I’d start a thread here and show everyone what I’ve got and see what you think.

Here’s a screenshot of my random planet generation code in action (previewed as simple textures at the moment):

20150920_181013_post.jpg

The first two examples above are the same settings, just with different random seeds. The third example is different settings to show how the random variations don’t have to all have the same style.

I’m using a library called Voro++ to generate a (3D) voronoi sphere as a base, simplex noise in a bunch of combinations to let me generate a nice variety of patterns, and Cairo to rasterize the end result (this let’s me zoom in indefinitely on the pattern). I’ve been taking inspiration from the work of other people online such as this person ] and this person ]. As you can see from their examples, there are lots of cool ways to add all sorts of interesting details to worlds when you use voronoi spheres, such as mapping out a range of different biomes, river networks and even weather.

For ground level details, I’ve been learning how to use the procedural mesh components in UE4, here is a screenshot of a custom terrain mesh using some random noise to set it’s elevation:

20150920_183412_post.jpg

At the moment it’s just one octave of simplex noise - hence the very basic pattern - but the same techniques that I’m using to make the planet level patterns more interesting are just as effective at this level too.

At the end of the day I’d like ideally to be able to do something like this ] only in realtime inside UE4.

Obviously though there are an ocean of challenges to swim across when trying to do something like this, so I’m just going to keep poking away and try and add a little bit extra each week and see where it ends up :slight_smile:

Managed (after much blood, sweat and tears) to swap out the Cairo Graphics library for a much faster one called Anti-Grain Geometry.

Now everything runs fast enough that I can preview the effect of all the different settings in realtime:

https://youtube.com/watch?v=oHD6Mm1P4yU

For this test I’m just doing a very basic earth like planet, but of course I’d like to be able to do all sorts of planetary bodies, from ones like this to moons, to gaseous planets to suns etc etc.

The idea is to use the settings to dial up a bunch of different designs, then to be able to scatter an infinite number of random variations of those designs around a virtual galaxy.

This looks awesome! Can’t wait to see more.

Small update - implemented “Lloyds algorithm” to smooth the spacing and size of the voronoi cells:

https://youtube.com/watch?v=Ec7UWruGQcI

The voronoi style is quite cool, but I am going for a more realistic look so the next step is to tessellate all the edges with a mid point displacement algorithm. Once I’ve got that going I’ll migrate my old spherical LOD code into UE4 and start projecting these textures onto that instead of the boring plane above.

Keep it up!

Finally managed to get the next bit going (took ages):

20151215_234900_mpdsWorking.jpg

So I can now subdivide and displace the voronoi cell edges to get that fractal coastline look.

More importantly, I can specify a focal point and a falloff range and as edges get further away from it they subdivide less.

That means I can pile on the detail near the player without having to worry about that being replicated across the entire planet surface and basically instantiating a black hole in UE4s memory usage.

Wow! This is awesome, keep up the work! I would love to see the out come of this.

So had a hard drive die on my first day back at work at the start of January, lost all of the fractal stuff above :confused:

Took me the whole month to redo it…

20160130_211400.jpg

Yay computers.

(All backed up with perforce now).

FINALLY got base mesh going… screenshots soon…

Sort of a fwiw screenie:

2d167a4aa14de6cd10db3ac232fd358e6b15f53d.jpeg

Obviously will be a bit more interesting when I get the dynamic sub division going…

I’d buy it if it was complete and in the marketplace.

What a great long weekend :slight_smile: Got heaps of coding done!

First of all I realised (belatedly) that everytime I used an FVector it was “floatifying” my beautiful doubles, so I spent a whole day fixing that.

Then I modified the topology of the mesh to reduce the pinching at the quadratic poles in the mesh.

Then today I got the octaves working:

20160328_212700.JPG

I almost got them repositioning around a designated point but it got all stroppy and my brain doesn’t do the clever after 10pm anymore so will have to keep hammering away this week.

This looks really awesome!

Cannot wait to See it finished with full scale procedural planets. :smiley:

  • HeadClot

Edging… closer… to… working… lod…

90a332e75bda82cec80b71b27e8acfd429597f59.jpeg

Sorry :slight_smile:

It’s just so nice to see the base terrain nearly working… another couple of nights and I should be able to move the LOD focal point around at will.

Once that’s going I can start adding in all sorts of different procedural height maps and mix between them with the dynamic texture above.

Keep the progress coming! Remember sleep is for wimps :stuck_out_tongue:

Alrighty then, finally get to show a working demo of my spherical terrain code in UE4 :slight_smile:

https://youtube.com/watch?v=3ymmsEQ6DTs

Still need to fix a few glitches that happen if I move the focal point too quickly, and I need to find a way to make the whole thing go faster…

But still, I’m pretty happy with the progress (even though it’s taken AGES to get this far).

And here it is in game:

https://youtube.com/watch?v=GBAtUTBlsH0

And for the record, I’m working on a five year old laptop so don’t be too freaked out by the framerate :slight_smile:

Is your code working in UE 4.11 as well?

It certainly is :slight_smile:

Fixed up a glitch that was ripping holes in the mesh if I moved the focal point too quickly (in the editor) which was driving me nuts.

Thought I’d see what the mesh look like 10,000 times larger with the subdivision levels cranked up from 3 to 8, no discernible impact on the frame rate :slight_smile:

https://youtube.com/watch?v=9gniFP6K3Y4

This is just me flying around manually in the editor, in game the lod focal point will follow the camera around and drop detail as your altitude gets higher.

Also, all the mesh generation settings are adjustable so I’ll probably increase the density of all the patches (they’re currently only 8 x 8 edges and each lod is made up of 4 x 4 patches).

The real performance challenge is approaching quickly - dynamic texture generation - each of those levels of detail will be getting their own texture.