About Store Forum Documentation Contact
Donations:
327$/mo



Post Reply 
Stateless Terrain Generator
Author Message
fatcoder Offline
Member

Post: #1
Stateless Terrain Generator
Hey everyone, I don't normally show my experimental work, but Zervox inspired me after seeing and talking with him about his cool terrain generator he posted the other day using the noise++ library.

I haven't been using Esenthel much for the past year or so, but over the Christmas break I decided to download the latest version and brush up my skills again as I'm thinking of getting back into Esenthel development one day. I had a full week up my sleeves and needed a small project I could work on for a bit of fun. Coincidentally, I chose to work on a terrain generator using the noise++ library (which Zervox introduced me to a while ago). lol

I got a bit carried away having fun and ended up building something bigger than I originally planned. I didn't get it all finished within the week, so I spent an extra day finishing some things off, fixing bugs and polishing it further so I could post these screen shots. I'm not planning on spending any more time on the project, and since I have no real need for a terrain generator at the moment, I'll be shelving it for now.

The tool uses a flow graph approach, which you drop modules (from a right click menu) on to and drag lines to connect them up. The flow graph (and its modules) can be resized and dragged, so you can create pretty big flow graphs. I ended up making the system pluggable, so each module is actually a DLL plugin. This makes it possible for anyone to write their own module plugins for the tool by including a single header file in Visual Studio (or the Esenthel Code Editor if you use that) and compiling a DLL. You then drop the DLL file into the tool's plugins folder and it will detect and load your plugin. The plugin system made it easy to convert all the noise++ modules to DLL plugins. I even ended up adding some new plugins as well that are not part of noise++, such as erosion, perturbation, averaging, and some other experimental ones just for fun.

I've multi-threaded pretty much everything than can be. The terrain changes as you adjust the flow graph and the individual properties on the modules, so experimenting to come up with interesting terrains is kind of fun. I've got code in there to manually adjust the terrain too, i.e. raise/lower/smooth/etc, however I don't have any gui controls for that stuff at the moment. You can export your finished heightmap out and you can also save/load your flow graph too. I have designed the whole thing so the core flow graph engine could be exposed as a stand-alone library (or DLL) that can be included in other projects. Then you could load a flow graph into it (that you previously designed) and actually generate procedural terrain in real-time within your project. grin

The terrain materials are just hardcoded at the moment. Please excuse my quick choice of poor terrain materials. I had plans of allowing them to be changed and to set the slope and altitude of each one to apply to the terrain. However this feature was low priority since the primary purpose of the tool is to generate interesting heightmaps using stateless math. I'm also missing some gui controls to allow the size, scale and resolution of the heightmap and terrain to be adjusted. So that stuff is hardcoded too at the moment, but that would be pretty easy to fix.

There are a few known issues. Such as problems with the gui that I can't fix relating to dragging the flow graph due to the way Esenthel windows handle the right mouse button and window resizing. Also, the terrain area mesh rebuilding is a bottle-neck that I can't do anything about unfortunately. Esenthel also doesn't use tri-planer terrain mapping, so you can end up with some crazy texture stretching on cliffs (the last screen shot demonstrates that pretty well).

Anyway, I had a lot of fun working on this little project. Thanks again to Zervox for introducing me to the noise++ library and thanks to Greg for Esenthel, one of the best game engines I've worked with.

I hope you guys enjoy the screen shots.

Some typical ridged multi noise, with a terrace applied to it.
   
The same ridged multi noise, but this time I've eroded it for a couple of thousand years. smile The terrain's mesh LOD makes it look a bit funny from a distance, but compare the heightmaps in the top right corner between this shot and the previous one to see how erosion affects the terrain.
   
And here is the same ridged multi noise again, but with a bit of scaling to give it a canyon look.
   
Here is a more complex flow graph. Just drop some better textures on it, with some grass, rocks and trees and you've got a nice terrain for an RPG.
   
Here's some voronoi noise mixed with some ridged multi noise to create a sand like terrain with some strange rock formations. Again, better material choices would bring this scene to life more. However I just wanted to demonstrate how different terrain features can be blended together.
   
Finally, here is a custom module plugin I threw together to create a weird effect. I'll leave you with that one. smile
   
01-15-2015 04:26 AM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #2
RE: Stateless Terrain Generator
Wow! It's a bit like waiting for a bus ... none come for ages then two come along at once wink

Joking aside, great work fatcoder. I love the use of flowgraphs to control the terrain generation, very practical and intuitive. Making it all multithreaded and a plugin shows how well this has been thought out.

Congrats to both you and Zervox on great implementations. smile
01-15-2015 09:41 AM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #3
RE: Stateless Terrain Generator
Fantastic work, fatcoder!

I love the use of the flowgraph. I want to use it too at some point, so I think it's very interesting. smile
01-15-2015 10:02 AM
Find all posts by this user Quote this message in a reply
LDA Offline
Member

Post: #4
RE: Stateless Terrain Generator
The flowgraph is really a good strategy.
Hope to see a particle system tool with such an interface smile

GG fatcoder !
01-15-2015 10:18 AM
Find all posts by this user Quote this message in a reply
georgatos7 Offline
Member

Post: #5
RE: Stateless Terrain Generator
This is very awesome looking indeed and very clean interface, i'm very interested in those terrain gens for my tech demo project as well.
Hope Esenthel had a way to integrate those things and use them in the editor without getting and changing the source, something like a "run code in the editor" thing.
01-15-2015 01:02 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #6
RE: Stateless Terrain Generator
I like what that last one does - that could make for some interesting terrain, especially if you can change from blocks to more natural-looking shapes to make it look like an earthquake ripped the area apart. Not that it matters until triplanar mapping makes it's debut....
Great work, though. It's pretty cool to actually see one of your projects. smile
01-15-2015 02:26 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #7
RE: Stateless Terrain Generator
(01-15-2015 03:16 PM)aceio76 Wrote:  Looks cool, but... what makes it stateless? pfft
The lack of states.
01-15-2015 07:37 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #8
RE: Stateless Terrain Generator
*Nice observation, Rubeus*

I think I just figured it out, it's the math that makes it conducive for multi-threading. But the heightmaps themselves are not stateless, which I thought what was implied in the title.
(This post was last modified: 01-15-2015 08:05 PM by aceio76.)
01-15-2015 07:40 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #9
RE: Stateless Terrain Generator
You should see my topic in Feature Request fatcoder regarding slow EI area generation. smile
01-15-2015 07:57 PM
Find all posts by this user Quote this message in a reply
Post Reply