How to procedurally generate deterministic, easily differentiable terrain?

69 Views Asked by At

For my A-Level computer science project I'm making an arcade game in which I need to generate a heightmap for 3D terrain. Originally I tried using a sum of sine curves (with randomly initialised x and y scale factors) as I need it to be easily differentiable (players are modelled as spheres rolling along the terrain so I need to know the gradient to calculate the portion of weight acting down the slope) but this doesn't provide a high enough periodicity or level of detail. So without a very high number of sine curves to sum (which is very computationally expensive) this doesn't seem to really work. Using a high degree polynomial is also difficult as the terrain should maintain roughly the same average height as the game progresses. I need to be able to initialise an equation for the curve at the start of the game and then base all calculations on that since terrain generation should be deterministic (unloading then reloading the same chunk should generate same terrain without having to store it in memory) so I don't think I can just use Perlin Noise unfortunately. Any ideas for alternate methods?

1

There are 1 best solutions below

0
On BEST ANSWER

Here is an example, written in Python, of how to generate such a hilly landscape as a Gaussian field. One generates a discrete field of psuedorandom variables and blurs it to introduce correlations. This field could easily be interpolated (to make it continuous) or differentiated. A Sobel filter is a cheap way to differentiate such a discrete field.

enter image description here