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).
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.
Answer
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:
Full spectrum:
And here's how it looked. Not bad for fractal at low detail imo...
No comments:
Post a Comment