Desktop/CAVE2 terrain rendering using tessellation shaders
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
examples
omegalib_module_test
scripts
shaders
.gitignore
CMakeLists.txt
INIReader.h
LRU.cpp
LRU.h
License.md
Material.cpp
Material.h
Program.cpp
Program.h
README.md
Terrain.cpp
Terrain.h
TerrainManager.cpp
TerrainManager.h
Texture.cpp
Texture.h
Thread.cpp
Thread.h
Utils.cpp
Utils.h
deploy.sh
stb_image.h
tessterrain.cpp
wqueue.h

README.md

Tessellation terrain

Desktop/CAVE2 terrain rendering using tessellation shaders.

Screenshots

Contact: Toan Nguyen (http://monash.edu/mivp)

References:

Prerequisites

  • OpenGL version >= 4.0

Omegalib module

Tested with Omegalib 13.1

Compile:

cd tessterrain
mkdir build
cd build
cmake ..
make

Run with python script:

import tessterrain

tt = tessterrain.initialize()
tt.initTerrain('vic_config.ini')

Functions which can be used in python script:

nextDisplayMode(n): change display mode.
displayInfo(): display information of terrains
toggleFog(): toggle fog in scene
setHeightScale(scale): set height scale for terrain

Standalone app

Tested with MacOS 10.12.4

cd tessterrain/app
mkdir build
cd build
cmake .. (or cmake .. -G Xcode to build XCode project)
make (or run build in XCode)

Run

./tessterrain [path/to/inifile.ini]

Keys

  • 'n': go to next display mode
  • 'i': print out camera information
  • 't': toggle fog
  • 'o': change overlay opacity

Configuration file (INI)

Example

[general]
terrains = 	s38_e141, s38_e142, s38_e143, s38_e144,
	        s39_e141, s39_e142, s39_e143, s39_e144,
sizeScale = 0.3, 0.3	; x, z
refPoint = -36.9998611, 140.9998611 ; lat, lon
preloadAll = 0          ; preload all terrrains
maxTerrainDisplay = 35  ; max terrains can be displayed
maxTerrainInMem = 40    ; max terrains can be stored in VRAM
numLoaderThreads = 4    ; number of threads to load texture images
bboxEnlargeFactor = 1	  ; enlarged bbox size += bboxEnlargeFactor*(bbox size)/2

; elevation data
terrainDir = terraindata/terrain
terrainFile = %s_1arc_v3_8.png 			; %s = terrain name defined in [terrains]

; texture (aerial image)
texture = 1
textureDir = terraindata/texture
textureFile = %s_1arc_v3_sat_crop.png

; overlay data
overlay = 0
overlayDir = terraindata/overlay/current
overlayFile = %s.png

; details
; geo position: tl.lat, tl.lon, br.lat, br.lon
[s35_e141]
pos = -33.9998611, 140.9998611, -35.0001389, 142.0001389
heightRange = 15, 144

[s35_e142]
pos = -33.9998611, 141.9998611, -35.0001389, 143.0001389
heightRange = 3, 135

...

Heightmap

Currently support heightmaps stored in a png file (red channel will be used) or a text file. Heightmaps can be generated from geotiff with scripts/dem2heightmap.py. The python script uses GDAL and numpy.