Hello there!
This Repository is full of my little java-projects. Have fun looking around! :D
Here is an Overview:
- Diamond-Square Algorithm (Terrain Mesh Generation)
Diamond-Square Algorithm ↗
The Diamond-Square Algorithm presents a very simple technique for generating natural-ish looking terrain.
You start with four vertices arranged as a square and assign each one a random height. Then comes the Diamond Step,
during which you compute the average of the four corners and add a center vertex with a height equal to that average ±
a random offset (the "variance"). During the follow-up Square Step, vertices are inserted at the edge of the square
similar to the Diamond Step, such that a
square grid is restored. If you repeat this process recursively a sufficient number of times reducing the variance as you go, you
get natural terrain looking something like this:
Naturally though, the programm only produces an .obj-file, which can be viewed with any 3d viewer of your choice. To make it more realistic and colorful, I used ShaderLabWeb, a web shader that's more or less intuitive to use. There, you just need to upload the .obj-file and can then test your shader-writing Skills :).
If you wish to learn more about this stuff, here are some links: