In this post, the steps for creating an OpenSceneGraph (OSG) scene will be described. As stated in a previous post, OSG is a 3D graphics toolkit allows us to create an scene from our virtual environment, and launch it on realtime web applications. This step in the project is key, because the previous steps are all made taking into account that all the data must be loaded into a OSG scene. For this research project, only terrain geometry and texture images are used to create the scene, since the main aim is to achieve to try different softwares/technologies that fits both the best photorealistic results and the costless procesing for landscape generation from GIS data base.
Case of study:
The scene is actually created with osgdem, which is a utility program for reading geospatial imagery and digital elevation maps (DEM's) and generating large scale 3D terrain databases that OpenSceneGraph applications can load and browse in realtime. The use of osgdem for this project is optimal because is designed for the kind of data we have. Also because the functionality that it offers, like the quadtree structure that allows tiles downloading on spatial demand, with Level Of Detail techniques that provide a multiresolution representation of the terrain geometry, with the ability to manage very large landscapes. (To learn more: http://www.isprs.org/proceedings/XXXVIII/5-W16/pdf/fanini_etal.pdf). The osgdem utility as been used as a compiled executable version, which can be launched on the Commad Prompt in Windows. Some samples may help others to follow these steps:
- One have to find the folder where the osgdem.exe file is located, and change the directory to that one:
cd C:\Documents and Settings\vhlab\Desktop\osgdem_bin
- The complete command to build the scene from the terrain and the image:
C:\Documents and Settings\vhlab\Desktop\osgdem_bin>osgdem.exe -e 280018.2306907435995527 4630911.4800800913944840 25526.047 35700.486 -d "C:\Documents and Settings\vhlab\Desktop\Santiago\VIRTUAL_ROME_2.0\GIS-DATASET\DemTevere20m_clipped.tif" -t "C:\Documents and Settings\vhlab\Desktop\Santiago\VIRTUAL_ROME_2.0\GIS-DATASET\landsat.tif" -o "C:\Documents and Settings\vhlab\Desktop\Santiago\VIRTUAL_ROME_2.0\GIS-DATASET\osg scene\test.osg"
- The extension of the terrain on our coordinate system is set by the command:
-e 280018.2306907435995527 4630911.4800800913944840 25526.047 35700.486
- The DEM file name plus the complete path is:
-d "C:\Documents and Settings\vhlab\Desktop\Santiago\VIRTUAL_ROME_2.0\GIS-DATASET\DemTevere20m_clipped.tif"
- The texture image (in this example, Landsat image was used) file and path:
-t "C:\Documents and Settings\vhlab\Desktop\Santiago\VIRTUAL_ROME_2.0\GIS-DATASET\landsat.tif"
- The output file and path of the OSG scene it's going to be created:
-o "C:\Documents and Settings\vhlab\Desktop\Santiago\VIRTUAL_ROME_2.0\GIS-DATASET\osg scene\test_colormapTerragen.osg"
- Finally, the scene can be visualised with the utility osgviewer, specifying thename of the scene and path, as the following sample states. After enter, a new window should open and show something like in the attached figure:
osgviewer "C:\Documents and Settings\vhlab\Desktop\Santiago\VIRTUAL_ROME_2.0\GIS-DATASET\osg scene\test_colormapVNS.osg"