Playing with terrain generation

I’ve been experimenting with terrain generation using procedural systems within the Flax editor. So far I have just been looking at automatic topology creation, with a focus on seamless integration with the existing terrain tools. I’ve got to this stage:

Which is an 8 x 7 terrain patch island (each patch is about 500 x 500m. I’ll probably have a play with terrain materials, but I do want to come back to the topology with a view to being able to easily add blended flat spots for settlements, mountain erosion and some paths / roads. I’d like to eventually release this to the community in some form, but it’s not ready for that yet.

If anyone has knowledge about flowing water systems (rivers flowing down hill into the coastal plane etc.) and is happy to share, I would be interested to hear. I have seen Emre’s work https://www.youtube.com/watch?v=RNBocVNCjE8, which has been helpful, I’m just trying to think of the best way to go with water as a whole (currently just using a blue plane to visualise sea level).

2 Likes

Well, I managed to construct a bearable simple water model that was entirely contained within a single material definition and I’ve just started to create an auto-terrain material:

I’d love to chat to anyone who has experience of any of the following:
Efficient anti-tiling strategies
Auto terrain material creation in Flax, especially attractive blending at boundaries
Splat mapping mechanics in general and within Flax

Your terrain generation is looking good. This is something that was/is on my list of things to try out in Flax but some other pre-steps had to occur before doing this. This was one of the things I wanted to do for the community here on Flax during my 1.6 hard core test (feedback given). Since you are doing this I can give you all the information I have to help. There is a lot of information below but all is specific to game engine terrains. They are handled differently…something I did not expect and found out the hard way. Flax’s terrain system seems to be very good and you seem to have an excellent start.

Thank You for doing this. Whether or not it becomes community or not it is very much needed. I would be happy to donate via Paypal once at the next stage. I am sure others would donate too.

No TLDR here…I kept most everything as condensed as possible though.

If you want/need further things on this please PM me. I can upload things to my FTP for you to grab to help with. UE4 has an excellent water shader too (the original UE4 Water…not the latest one). I have great normals for waves. You are welcome to these. I can also add more screen clips here in this topic to keep this open for the community.

Some thoughts here from doing a lot of landscaping in both Unity and UE4 (I have 15 10km x 10km) regions done in both using the same height maps filled out with 3D vegetation, snow drifts, and 3D mesh roads. Procedural is great but only does 80% of the work, but is a huge win to help make things look natural without the human tendency for personal replicated taste. Best if the human works with the last 20% after in my humble opinion.

I guess the main advice here if you make this terrain system is…Keep It Simple Stupid…KISS. Unity’s Gaia and CTS had it almost perfect before it had far too much scope creep. UE4 has a couple automatic landscape products on the marketplace and I gave up on them since they are performance hogs and modifying them when something is outside of what the designer’s vision is (example…the vision is mostly to replicate earth forests and grasslands with mostly rolling hills…makes sense I guess…they are pretty). MicroSplat in Unity had the best solution and was very performance friendly. The ‘Make Terrain Button’ does not exist. LOL!!

For the Terrain Auto Material I can help get you started with what needs to be done. In theory it should transfer well. This is a UE4 landscape material I developed from migrating from Unity then watching a couple videos on how to work with the landscape layering system in UE4. Flax ‘should’ have these but unsure. Might need some Flax support to make sure these options are available or the landscape layering will be a mess like in Unity (very difficult to work with).

Unity Refs used in this design: MicroSplat (mainly) and an old version of CTS.

A small note on Splat Mapping style terrain layering from experience. The best success of a good splat map was using L3DT to output a Splat Map along with the seamless tiled height maps. Works great…but…I always had to go back and hand paint to get rid of a lot of artifacts (both Unity and UE4). In light of this I decided to simply skip the splat and hand paint. I think you will find with doing a landscape material like below hand painting is extremely fast with very few artifacts. Rocks are great artifact fixers in any case. :slight_smile:

Terrain Textures (I have textures I could donate/help with if needed):

  • PNG (RGB no Alpha so not RGBA)
  • No larger than 2048x2048 (or you will hit texture memory limits fast)
  • Bake your AO into the texture (I will briefly explain how below this)
  • No need for SM (specualr map). Simply set the specular to 15,15,15 or 32,32,32 RGB to start.
  • No need for displacement maps or any other map…saving valuable texture memory!
  • Use GIMP 2.10 and the Normal Map Filter to generate your normal maps (Photoshop does terrible Normals).

Making terrain textures look almost 3D:

  • Each texture has what is called Texture Fog.
  • Drag your texture into GIMP 2.10, Layer, Brightness/Contrast.
  • Slide your Contrast left and right. Takes practice but you will see where the texture transitions from soft to sharp…this is where all the texture fog is removed. Slide to slightly right to add some softness back in. You will see what happens but the texture will have ‘Baked in AO’ and will look almost 3D.
  • Now slide the Brightness down a little to add some AO to the texture.
  • Done. Export (Note: the GIMP xcf format is a very good method to store your texture libraries)

GIMP Normal Maps:
Search for GIMP Normal Map Plugin. Here is the github link for it. Same filters found in the NVIDIA plugin.
GitHub - hhirsch/gimp-normalmap: Automatically exported from code.google.com/p/gimp-normalmap

I find this works best. Normal Maps should be subtle…especially for terrain textures.

  • Set your Scale from 3.0 to 5.0. Start with 5.0 and test to see. Varies per texture and lighting model. More than 5.0 and the normals start to show artifacts. Prewitt 3x3 also works well.
    image

Details:
The Flax Manual does not have many details on the Terrain Material Layering. In fact it is very vague on how to do layering. The manual does show the base layer then hand painting layers on top. The layer material looks like a standard material in the Terrain Domain. Not sure what the limits of layer blends Flax has. UE4 is 8 (more it gets frisky and causes a lot of issues…remember that SM5 is limited to 16 Texture Samples…which all games engines are limited to for now…more than 8 will run out of texture space and create very large CPU and GPU texture loads).

So this Auto-Landscape Layering is 8 Layer Blended (almost no tiling) and works simply by painting the texture layers on the terrain. You can automate the layer texturing but I find painting by hand works best after the terrain itself is shaped. For example: a 10,000m x 10,000m take about 8hrs to fully paint from start to finish. So it is very fast. It also had grass (2 layers with any 3D plant) and snow cover masking built it so it covers most any terrain needed.

A note about things like trees and rocks. I spray these down in a 3D brush then hand adjust since procedural tools do most of the heavy work to keep clicking down and great randomization but always need some sort of adjustment on a few items, especially on slopes which are everywhere naturally.

The Output section: 8 Landscape Layers Blended.

Auto Slope Function:


Note: Below here you will find that each layer is very similar, which they are. :slight_smile: This makes everything consistent and simple to adapt.

Base Terrain Layer (Rock Layer…this is what everything paints on top of)


Dirt Layers (1 & 2):


Grass Layers (1&2):


Sand Layers (1&2):


Snow Layer:


Procedural Grass/Foiliage (tied to both of the Grass Layers):



A sample of what this will do. This is only the material and terrain mesh (done with L3DT) and with Ultra Dynamic Sky (UE4). I am positive this can be done in Flax.

2 Likes

Thanks, there’s a lot to digest there so I’ll let you know as I progress. Unfortunately most of the UE shader functions need to be recreated in Flax, so it is not necessarily quick to implement UE mats, but I’ll take a look at them soon.

I put this on my things to figure out. I’ll start doing some conversion next week to figure the conversion out and try to work within Flax v1.7 as it is now. So far since I started in Flax v1.3 nothing has broken except the Normal Map hack fix to flip the green channel.

I’ll post some feedback screen clips here. This is something I do need in January to start repainting all these landscapes. I’ll also try out the water material as well and make a community give away for it in a different post. We all need a good-looking water solution that can be built upon for specialized things.

Cheers
Olander

@AITheSlacker Taking a little longer than I thought but most of the terrain layer material stuff are transitioning nicely. I like to test to cross the T’s and dot the I’s as I go to eliminate bugs and issues. I also make a tech doc along side so that I can remember :rofl: how these things work once I return to them or…

Give them to others.

To be clear I will continue using World Creator to generate my landscapes (L3DT is still great though). I think your terrain system looks great and is well needed. These landscape layer materials will be a Community give away though. As long as the terrain is a Flax Terrain it will work.

I am not there yet but I will see how many layers Flax can manage. I will post back as I progress and also in a week post a new landscape community showcase.

That sounds great, I look forward to trying it out!

I think Flax supports up to 8 layer weights, although I have not tested anything that complex. It also supports material tessellation, but when I looked at the mesh in the editor it appeared that was uniformly across the terrain, regardless of need, so that may be quite an expensive option - but I have no real experience of that either. I’ll try and release the code I have by the end of Jan 2024, I’ll post here when it happens.

I have 4 blending nicely now, no issues so far. Have not added the physical mesh options yet so just blending of textures. I will post here and a new community posting once I get there. Looks to be sooner than the end of Jan 2024.

I am not a fan of tessellation. It is expensive and very specific purpose. It is a nice effect but I will not be adding it to the terrain material. Someone else can do that if they need that specifically.

1 Like

I posted my findings with the issues with Flax terrain texturing (possible other issues) here:
Terrain Issues with Details 1.7.6 - Editor - Flax Forum (flaxengine.com)

So as to the terrain texturing is mostly on hold. There may be a different method to do this as stated in the PM. Disappointing but is what it is.

1 Like

That’s really cool! Is this all done in one stage or are you generating real time?

@Zaya6
The terrain topology is a multi-step set of tools that run in the editor. They could be adapted to run in real time (I guess you are thinking about a run time terrain), but that would be a really big step to create and integrate with all the other game systems - definitely not my plan.

I’ve released a build of this for anyone to use, please refer to this thread:

And give your feedback there. I hope this helps someone!