10
\$\begingroup\$

The question isn't the greatest wording ever sorry.

I have been learning about and prototyping some texture and terrain generation stuff and have run into something perhaps you can help me with.

How it works: I am procedurally generating a terrain height map. It can scroll endlessly in any direction. (image 1) I clamp and mix the colors depending on the value of the height map (image 2)

This is working very well and runs very fast currently, it is after all very simplistic at the moment.

What I need to find is a good way to blur/distort between the terrain transitions. As you can see currently it has very ridged lines and doesn't look all that natural. Given that this is whole thing is procedurally generated I obviously need to find an algo for the blending that can run on the fly. I attempted a bit of pixel jittering and it just looked bad. Also what ever I use has to be able to be seeded so that it maintains consistency (though I doubt that will be a problem since they will most likely all run on randoms).

GreyScaleHeightMap ColorHeightMap
Any insight would be much appreciated. If I managed to leave out any needed info in my rush to post this just let me know.

\$\endgroup\$
0

1 Answer 1

14
\$\begingroup\$

When I did this I ended up making a simple gradient file (xml or image based, doesn't matter) that predetermined the color used at the specified distance between the primary height colors (grass vs. sand for instance). This way, there were inbetween states. What is great about this is that you have full control over the transitions.

I suppose that you could also write something that found the mix color based on primary color distance in height via some sort of blending, but, not being a developer beyond hobby, I'm unfamiliar with such technologies (yet).

Here's some gradients I've used. Note that it you can adjust the colors based on the current height:

More grassy/coastal: enter image description here

Full spectrum: enter image description here

And here's how it looked. Not bad for fractal at low detail imo...

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ This is perfect. I don't know why I didn't think to use a gradient. Thanks. \$\endgroup\$
    – Feltope
    Jun 17, 2011 at 23:47
  • \$\begingroup\$ Great! I'm glad I could help :D \$\endgroup\$
    – Kevin Peno
    Jun 18, 2011 at 1:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .