Raytracing with terrain

From World Wind Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 14:42, 16 March 2007 (edit)
Withak (Talk | contribs)

← Previous diff
Current revision (19:40, 16 March 2007) (edit) (undo)
Patmurris (Talk | contribs)
m (Antispamed email address)
 
Line 1: Line 1:
Picking at terrain for NASA World Wind 1.4 Picking at terrain for NASA World Wind 1.4
------------------------------------------ ------------------------------------------
-by Patrick Murris <patmurris@videotron.ca>+by Patrick Murris <patmurris (at) videotron.ca>
March 16, 2007 March 16, 2007

Current revision

Picking at terrain for NASA World Wind 1.4


by Patrick Murris <patmurris (at) videotron.ca> March 16, 2007

These sources are modifications to some WW classes to add a PickingRayIntersectionWithTerrain() method to the CameraBase class.

Included is PickAtTerrain.cs a test plugin that displays the lat/lon/alt under the mouse pointer.

Contents

[edit] Camera.cs

  • Added PickingRayIntersectionWithTerrain(): Same arguments as PickingRayIntersection() with the addition of the current world (needed to use the TerrainAccessor).
    • Use ray casting with a sampling length of 100m.
    • Use a new memory only method to get elevation from terrain (see below)
    • More suited for close range picking (under 60km altitude)
    • Needs some optimization and tuning but works well.
  • Changed ComputeAbsoluteMatrices() - View matrix logic
    • Use currentCameraElevation in the same way as the 'real' view matrix in ComputeViewMatrix(): WorldRadius + curCameraElevation instead of WorldRadius
      • this._distance + curCameraElevation instead of
      • this._distance - curCameraElevation
    • Affects picking and view frustrum when ElevateCameraLookatPoint is true.
    • Tests ok so far.

[edit] NltTerrainAccessor.cs

  • Added GetCachedElevationAt() method to retreive elevations without triggering downloads in foreground. Uses memory data only.
    • Will get the best available data from the terrain accessor cache.
    • Will return float.NaN is no data found.

[edit] TerrainAccessor.cs

  • Added virtual GetCachedElevationAt()

[edit] TerrainTileService.cs

  • Made NumberLevels public

[edit] Known issues

  • Terrain picking doesnt work well and can become very slow if used from far away - especially at startup when no elevation data is in the cache yet. Use the regular PickingRayIntersection() above 60km altitude.
  • Ray casting sampling logic needs some optimization.
Personal tools