Jump to content

Concept of Layers in Terrain Generation


Sessional

Recommended Posts

I have managed to get terrain generation to work using a series of noise functions. I have an interest in applying a layering attitude for this to avoid rough terrain changes as following

9gxaqh.png

 

 

I'm under the impression that with layers you would start at the most basic layer, and apply more specific ones as you go. The problem I am struggling with is the grasping how this applies to the noise functions I've been using.

 

For example: Using a Voronoi noise function as follows for the determination of a terrain biome. As a basic example each shade would come out to be a different biome.

width=250 height=250http://www.neilblevins.com/cg_education/procedural_noise/cellular_round_bercon_solid.jpg[/img]

It is simple to map these shades into different biomes. But now, how would I go about taking into account that two adjacent shades may be very different heights? For example, the black ones might end up being 100 blocks high, whereas a lighter grey may end up being 60 blocks high.

 

It would be nice to be able to apply a layer into that shade of grey to force it to transition from 60 blocks to 100 blocks in a smooth transition rather than a steep incline. If I knew the shape of the biome ahead of time, and what biomes it is adjacent to I would, in theory, be able to apply a blending function to the noise to force a smooth transition. However, I do not know these values all the time during terrain generation.

 

Any suggestions for where to look?

Link to comment
Share on other sites

Apply a box blur across your biome height map.  It'll soften the edges and provide some transition.  That is, if that grayscale image was your height value, blur it.

 

But basically, this is why vanilla has technical biomes like Extreme Hills Edge and Mushroom Island Edge.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

What process would you suggest I use to blur something? Would this be a mix of multiplying two height map images together to help reduce the range of difference in it? Or would I be doing something more like just reducing the variation in acceptable noise output?

Link to comment
Share on other sites

A simple blurring algorithm is to make each pixel the average of the surrounding pixel values and itself.

 

To generalize it to your image, instead of having a square pixel grid, the "pixels" here can be other shapes (the different regions in your image), and it doesn't have to be in a grid.

 

You can represent each region of your image as a node of a graph (graph) where nodes are connected if the regions that they represent share a border:

width=400 height=125http://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Four_Colour_Planar_Graph.svg/400px-Four_Colour_Planar_Graph.svg.png[/img]

 

For each node, you can do a depth-limited breadth first traversal to obtain the surrounding nodes. Then you can just average the values, and set that source node to the average value.

 

In the case of a regular image, each pixel would be a node, and the graph is like a Cartesian plane, but in your case, the nodes are arbitrarily arranged, but the graph is still planar.

Link to comment
Share on other sites

What process would you suggest I use to blur something? Would this be a mix of multiplying two height map images together to help reduce the range of difference in it? Or would I be doing something more like just reducing the variation in acceptable noise output?

A simple blurring algorithm is to make each pixel the average of the surrounding pixel values and itself.

 

Which is what a box blur is.  But it explicitly deals with pixels.  If the height map thing isn't stored in a grid, then the boxblur doesn't make any sense.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

What I'm saying is you can generalize the box blur algorithm to things that aren't grids.

 

A grid is essentially a Cartesian plane graph, where each node is a pixel (square region), and two nodes have an edge between them if their respective pixels are adjacent.

 

A generalization of the box blur algorithm is apply it to an arbitrary planar graph instead of a Cartesian plane graph. Each node just represents a polygonal region (like the Voronoi partition above) instead of a square region. Since the Voronoi partition works by using a set of points, the the graph construction is pretty trivial (just take those points and have them be the nodes of the graph, and each point would represent the region that the point is in, like the image above).

 

Of course, I'm assuming that taking the Voronoi distribution and just applying a box blur to the image isn't what the original poster wants (since that distribution is a biome map, not a height map), and he wants to map biomes to the regions without changing the shape of regions themselves.

Link to comment
Share on other sites

True enough.

 

I'm not sure how I'd go about "solving" the problem, as that kind of mesh network doesn't really have a concept of "edges" that you can go "oh that location is at / near an edge, do X."

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

As far as that goes. I think that points me in the right direction.

 

That grey scale image is the biome map, not the height map.

 

What I am using for a height map is some smooth noise that dictates the change from the biomes root height.

What I will do is this: I will populate a height map for the chunk, I will then smooth the final height out by taking the distance (<= 6) from the nearest biome shift and normalizing the height in these areas to simulate the "edge biome". This should allow me to make 6 tiles into each biome as a transitional height period to smooth the height. (Hopefully...)

 

If you have any insight on this method I'd be interested to hear it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.