• Stars
    star
    103
  • Rank 333,046 (Top 7 %)
  • Language
    C++
  • License
    MIT License
  • Created over 4 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Procedural terrain generator with tessellation | C++ OpenGL 4.1

Procedural-Terrain-Generator-OpenGL

Procedural Terrain Generator With Tessellation OpenGL 4.1 | C++

Terrain with water relfection

YouTube video: https://www.youtube.com/watch?v=KDmZJgTf-HE

How it work?

Terrain: For creating realistic surface I choosed Perlin Noise or simply noise method to generate heightmap. Heightmap is stored in 2D texture. The same data which we generate is used for convert heightmap to normalmap. That process is achieved by using Sobel Operator and normalize texture data. By the way it is easy to generated normal in shaders but that is expensive for efficient of our gpu. CPU do that faster and once, so for me better. And again we have to pass normalmap to graphic card memory as 2D texure. So now we have two textures. We can pass textures to shaders and use as samplers. Heightmap is used to increase y-axis in tesselation evaluation shader and normalmap is used to calculate the normal of surface to make proper light. OpenGL 4.0 provide us tesselation feature. With Tessellation it is easy to create terrain with dynamic level of detail. Distance between surface and camera can be used for evaluation the LOD. So if we're farther from the surface it will be rendered faster. Answer is short: tessellation is also in use in this project.

Water: Water is a simple plane without tessellation. The water is using dudv map for realistic movement the water and normalmap to calculate light. Water include reflections and refraction for good visual effect. The reflection on the water are created by bind the custom framebuffer and render the scene, but before we have to set the camer under the water. This method allow us to save actual scene to the texture instead straight to the screen something like post processing but we pass that to the water surface not to the screen space. The refraction are creating in the same way but the clip distance is different for each step but camera must be above the water level. For reflections we are rendering scene above the water and for the refraction all what is bellow the water. In the end all of textures are mixing in fragment shader and creating realistic calm water. This method force rendering the scene three times and once the water.

This application is based on my own Engine 3D.

Control/Input:

  mouse - rotation the camera
  WASD - movement
  P - polygon mode on
  O - object mode on so off polygon mode
  Y - increase level of tessellation
  T - decrease level of tessellation
  C - shadows on
  Z - shadows off
  N - water on
  M - water off
  ESC - exit
  1-0 - Ten methods for terrain generation
  = - increase height level
  - - decrease height level

Package includes exe file compiled in Windows 10 MinGW G++ and dll files.

Requirements:

  • Efficient graphics card that support OpenGL 4.1
  • Graphics card drivers

Tested on RX 480 and GTX 650 ti.

Screenshots:

Terrain ss 1 Terrain ss 3 Terrain ss 4 Terrain ss 5 Terrain ss 6 Terrain ss 7 Terrain ss 8 Water first ss Water last ss

More Repositories

1

StickMan-3D

StickMan 3D: First Round | indie fighting game | C++ OpenGL
C++
70
star
2

Ocean-OpenGL

Simple ocean/sea/water simulation | C++ OpenGL 4.1
C++
37
star
3

Tinder-Bot

Tinder Bot 2021: Automate your likes and dislikes. Increase Match level.
Python
36
star
4

3D-Engine-OpenGL-4

3D Graphics Engine For Games | C++ OpenGL 4.1
C++
25
star
5

Perlin-Noise-3D-Voxel-Generator

Voxel generator based on perlin 3d noise | Python OpenGL
Python
23
star
6

Laravel-Blog

Laravel 8.x Multi-language Blog. Your well start with blogging.
PHP
16
star
7

sosgame

SOSGame Desktop Mobile MMORPG Game : Build your own team and fight with bosses
PHP
8
star
8

SOSEngine

2D Game Engine based on HTML markup
JavaScript
4
star
9

stanfortonski.dev

stanfortonski.dev
JavaScript
3
star
10

laravel-ecommerce-api

Example Laravel Ecommerce API
PHP
3
star
11

terminal-game

Terminal RPG game
C++
3
star
12

React-Posts-Searcher

Example React app that allow us to finds posts
JavaScript
2
star
13

vue-reservation-app

Example app created with Vue
Vue
2
star
14

stanfortonski.github.io

Page with examples of web development technologies
HTML
2
star
15

react-weather-app

Example weather app created with React
JavaScript
2
star
16

lang-dictionary

Better way to learn your words from Google Translate.
JavaScript
1
star
17

Room-Viewer-PyOpenGL

Example app that use PyOpenGL | OpenGL 3.3
Python
1
star
18

Laravel-Twofactor

Two-factor authentication package for Laravel 7.x, 8.x
PHP
1
star
19

Java-Swing-Image-Viewer

Example Java App | Image Viewer | Java Swing
Java
1
star
20

Laravel-Roles

Users roles for Laravel applications 7.x and 8.x.
PHP
1
star
21

Arduino-Melody-Ode-To-Joy

Arduino Melody: Ode to Joy
C
1
star