Raytracing with terrain
From World Wind Wiki
(Difference between revisions)
Revision as of 14:34, 16 March 2007 (edit) Withak (Talk | contribs) (New page: Picking at terrain for NASA World Wind 1.4 ------------------------------------------ by Patrick Murris <patmurris@videotron.ca> March 16, 2007 These sources are modifications to some WW ...) ← Previous diff |
Revision as of 14:42, 16 March 2007 (edit) (undo) Withak (Talk | contribs) Next diff → |
||
Line 7: | Line 7: | ||
PickingRayIntersectionWithTerrain() method to the CameraBase class. | PickingRayIntersectionWithTerrain() method to the CameraBase class. | ||
- | Included is PickAtTerrain.cs a test plugin that displays the | + | Included is [http://pneumatictu.be/PickAtTerrain.cs PickAtTerrain.cs] a test plugin that displays the |
lat/lon/alt under the mouse pointer. | lat/lon/alt under the mouse pointer. | ||
Revision as of 14:42, 16 March 2007
Picking at terrain for NASA World Wind 1.4
by Patrick Murris <patmurris@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 |
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.
- Use currentCameraElevation in the same way as the 'real' view matrix in ComputeViewMatrix(): WorldRadius + curCameraElevation instead of WorldRadius
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.
TerrainAccessor.cs
- Added virtual GetCachedElevationAt()
TerrainTileService.cs
- Made NumberLevels public
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.