6
\$\begingroup\$

I want to implement something like this to create a heightmap: 'Place a group of coordinates evenly across a map, and give them height values within a certain range. Repeatedly create coordinates between all of those coordinates, setting their height by deriving a value that was a mean value of all the surrounding coordinates.'

However, I'm not sure how I would go about it - I'm not sure how I could code the part where I place the coordinates in between the existing coordinates. Can anyone give any help/advice?

\$\endgroup\$
2

1 Answer 1

4
\$\begingroup\$

Although it seems others also gave some answers in the comments, here's my experience:

There is a physics simulation problem known as heat flow/heat equation. That link gives you the whole idea about what you are going to simulate in that problem and there are many ways to create an optimized version of that simulation (just need a little Google search).

In my experience if you just give a constant heat value to some points and then leave the surface to rest for a while, you can get a very good height map based on the temperature of each point (just set each point height as its temperature). There are also some algorithms that generate the final result directly from the input values, but in your case I wouldn't recommend them unless you want to generate maps at runtime.

There are also some algorithms that give you the ability to modify the normal heat flows to get more complex heightmaps with less effort.

\$\endgroup\$

You must log in to answer this question.

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