Virtual Planet Builder
- Category: Virtual Planet Builder
- Published on 14 February 2013
- Written by Torben Dannhauer
- Hits: 2101
Supported OSG Versions
Versions of OSG since February 10th 2012 (>3.0.1) support the caching of OSG models from local sources. This is required to follow this tutorial.
The idea behind this example is to take an existing database that was built with VPB and use osgfilecache to 'cache' the local terrain database to another local directory. osgfilecache supports level/extends limitation, so it is possible to extract only terrain within certain bounds or level of detail.
- Let /home/large_database = the root of the original (large) database, i.e. the directory where the top-level .osgb file is located.
- Let /home/database_part = the root of the destination database with limited extends. It should be writable to allow osgfilecache to write the files into it.
- The large source database root was called terrain.osgb (/home/large_database/terrain.osgb)
- The large source database was build in geocentric mode.
- Using bash on Linux. Replacing the pathes it should be possible to follow the recipe also on windows. Be aware of he limited NTFS performance and stability if you try to extract giga-/terabyte size datasets'''
One note before we start with the commands: pagedLOD nodes store the database path, which is the path to the file. This path is overwritten by osgfilecache. To get a independent new sub database with relative paths, you mast enter the directory of the large source terrain database before you invoke osgfilecache. Otherwise you will get a terrain dataset with absolute paths which will cause OSG to continue loading from the original database instead from the extracted limited dataset.
Enter the source terrain dataset
The command structure is 'osgfilecache --file-cache <your destination folder> <options to control the new database extents> <relative path to your source database root file> For example for the above assumptions, it would be the following to extract the database until LOD level 3 ('-l 3'):
osgfilecache --file-cache /home/database_part -l 3 ./terrain.osgb
According to the osgfielcache help, the following extend definitions are allowed:
-e level minX minY maxX maxY Read down to <level> across the extents minX, minY to maxY, maxY. Note, for geocentric datase X and Y are longitude and latitude respectively. -l level Read down to level across the whole database.
To extract lon 11-15 and lat 30-40 until level 8:
osgfilecache --file-cache /home/torben/test -e 8 11 30 15 40 ./terrain.osgb
Note: You can run osgfilecache multiple times in the same directory to 'compose' a new database with different extends. E.g. worldwide<=level 5, europe<=level 8 and germany<=level 25