A group project done for a course during my bachelor’s degree.
The program uses a grayscale heightmap to extract the values and pass it on to the vertex shader which displaces the individual vertices in order to deform the plane accordingly.
Thereafter the fragment shader proceeds to catch the heightmap values and apply the correct texture based on height whereas the lower points will be grass, middle points will be mountains and the top parts will be covered in snow. The lighting is done by normalizing the vec3 normals passed in from the vertex shader in order to get the proper illumination based on the faces of the mesh itself. Without this approach of normalization, the model would still be considered a flat plane as the source of light wanders across it – thereby eliminating any kind of shadowing or spectral highlighting where it should be applied.
Done some further work on it in my spare time in the hopes of creating a very lightweight terrain-generator based on heightmaps and the ability to export the final mesh as an OBJ as well as export the normal maps through the shader.