Version 7 (modified by 14 years ago) (diff) | ,
---|
TracNav
Documentation
- Getting Started
BuildEnvironment...
- Terrain Data
- Architecture
Modules...
osgVisual Configuration via XML...
- SerializationNotes
- ExecuterNotes
- CameraControl
- Theories of Terrain Deformation
- Theories of Image Distortion
- Home
About...
- Screenshots
- Downloads
Projection Designer...
- Wiki Edit
- Website Credits/Impressum
Terrain Deformation : Approaches to modify terrain tiles
- Implement a custom txerrainTechnique to modify at runtime -> Flexible but eventually slow
- Patching a VPB database persistent -> Low delay, patching irreversible, not flexible
- Creating patched sub databases, runtime branching to the alternative patched sub database (only a lookup table in the tileLoadCallback) -> Complex implementation, supposed to be fast
- Pseudoloader which modifies the tiles while the are in the loading pipeline, the complete tile compilation will be done in the databasepager thread -> Complex implementation, flexible, slow but no framedrops
- Use osgEarth. Runtime modification is not possible, but each run of osgVisual could have other setups and other displacements.
Modifying terrain using a custom terrainTechnique
- tilesLoadedCallback: Must be used for VPB databases < 2.9.10 because these DBs contains a compiled in standard geometryTechnique, so terrain->terrainTechniquePrototype() is never queried.
- Custom geometryTechniquePrototype: Can be used on VPB databases >= 2.9.10 because here the standard geometryTechnique is not compiled in, so terrain->terrainTechniquePrototype is queried and can be used as custom terrainTechnique over the whole database.
Modifying terrain patching a VPB database persistent
- Use VPB's --patch function. The patches must have a higher resolution than the database to patch. todo: Create algorithm t calculate displacement and create ESRI .arc files.
Modifying terrain by creating patched database in alternative subtiles of the database
TBD
Modifying terrain by using pseudo loaders
TBD
Modifying terrain by using osgEarth
osgEarth can be used by loading a *.earth file in osgVisual instead of an VPB database. skySilverlining must be modified because osg::Fog can't be applied on osgEarth terrain. A fragment and vertex shader is available to plug it into osgEarth shader compositor. The performance of osgEarth is quite high since version 2.0, the tile preparatino is done outside the rendering and update thread, so framerates are quite high. Oee problem is to specify the correct LOD level to load a solution has to be determined.
Approaches to modify terrainTile heightfield
- Modify heightfield prior to tile's init() call.
- Overload init() and modify inside init() before generateGeometry() is called.
Calculating the new height values
- Checken id tile is affected ( xmin < x < xmax && ymin < y < ymax ) or ( latmin < lat < latmax && lonmin < lon < lonmax )
- If affected, check for each vertex if row/colum is inside the region of interest
- If inside region of interest: modify values
- Using an image as source for tile patch: Auslesen des Images je Spalte, interpolieren der Werte auf Tile-Bereich und Vertexanzahl und addieren/ersetzen der ursprünglichen Werte.
- Using a math function as source for tile patch: Berechnen des Additions-/Zielwertes je vertex und addieren/ersetzen des ursprünglichen Wertes. Eingabewert in Algorithmus: Lat/Lon? der 4 Tile-Ecken. Algorithmus kann für lat lon der Vertices in der Tile linear interpolieren.
- Using an image as source for tile patch: Auslesen des Images je Spalte, interpolieren der Werte auf Tile-Bereich und Vertexanzahl und addieren/ersetzen der ursprünglichen Werte.
Approaches to cut holes into terrainTiles
- generateGeometry umbauen, so dass es keine Oberfläche und keinen Skirt an spezifizierten Stellen bildet.
-> Definition eines shapes notwendig, da beim Ausschneiden ein simples Rechteck wie bei Heightmodifikation nicht ausreicht. Per Vertex: Inside polygon nötig. --> Aufwändig
- einene weiteren "map" layer einbauen der pro Vertex entscheidet ob der Vertex gerendert wird oder nicht.
-> Todo: Switchlayer ansehen, evtl ist dass ja schon sowas.
- Alpha in der Textur aktivieren für Stellen die Löcher haben sollen und blenden lassen.
-> Todo: Wird zFightfing vermieden wenn einer der Partner transparent ist? vermutlich nicht.) -> Todo: VPB Texturen liegen komprimiert vor, müssten dekomprimiert werden um Alphawerte zu ändern.
- Shader nutzen, um im Fragmentshader die transparenten Elemente des Terrains zu verwerfen mittels discard keyword.
-> todo: Wie kann man Terrain zu allen anderen Elementen unterscheiden?
Cutting holes into terrainTiles may be unneccessary by modyfying terrain height under models with baseplate. lowering terrain surface under the base plate may be sufficient to avoid zFighting.(Workaround until it is possible to cut wholes into earth.)