Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 12 down vote accepted

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

share|improve this answer
    
This is perfect. I don't know why I didn't think to use a gradient. Thanks. –  Feltope Jun 17 '11 at 23:47
    
Great! I'm glad I could help :D –  Kevin Peno Jun 18 '11 at 1:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.