Insight3D supports terrain in the .pdtt format. This format is optimized for rendering performance. You can create .pdtt files from a wide array of terrain formats, such as DTED and DEM, using STK. This alpha version of Insight3D does not include tools or an API for creating .pdtt files.
Terrain is added to the inlay manger using either the AddURI or Add method as shown in the Inlay Manager section. Using the AddURI method generally results in less code but in some cases it is worthwhile to create an inlay object and delay adding it to the inlay manager. The following example shows how to display the rectangular extent of an inlay without adding it to the inlay manager.
IAgGxCentralBody earth = sceneManager.CentralBodies("Earth"); IAgGxGlobeInlay inlay = new AgGxGlobeInlayTerrainChunk(); inlay.Initialize(earth, Program.uriLocalDataPath + "TerrainAndImagery/StHelens.pdtt"); IAgGxTriangulatorSurfaceExtent triangles = new AgGxTriangulatorSurfaceExtent(); triangles.InitializeFromExtent(earth, inlay.Extent); IAgGxPrimitiveTriangleMesh mesh = new AgGxPrimitiveTriangleMesh(); mesh.InitializeFromTriangulator(earth, AgGxReferenceFrame.ReferenceFrameFixed, AgGxVertexUpdate.VertexUpdateNone, triangles); sceneManager.Primitives.Add(mesh);
An inlay is created and initialized but not added to the inlay manager so it is not rendered. Instead, the inlay's Extent property is used to create a triangle mesh primitive that shows the rectangular extent of the inlay. See the Triangle Mesh Primitive Overview for details on the primitive. At a later point, perhaps in response to the user picking the extent on the globe, the primitive can be removed and the inlay added:
sceneManager.Primitives.Add(mesh);
scene.GlobeInlayManager.Add(inlay, AgGxInlayRole.InlayRoleNormal, true);
This technique also applies to imagery inlays.
Terrain inlays supports user-defined altitude scale and altitude offset. As shown in the table below, Altitude Scale is a visual aid used to exaggerate terrain and Altitude Offset is a visual aid used to uniformly raise the terrain off the globe.
|
|
|
No Altitude Scale or Offset |
|
|
|
|
Altitude Scale: 2 |
Altitude Offset: 3,000 |
These properties are set using the IAgGxGlobeInlayTerrain interface as shown below.
IAgGxGlobeInlayTerrain terrainInlay = inlay as IAgGxGlobeInlayTerrain; if (terrainInlay != null) { terrainInlay.AltitudeScale = 2; terrainInlay.AltitudeOffset = 3000; }
Since terrain files can be extremely large, the entire file is not kept in memory. Instead, a small portion of the file is kept in a memory cache. As the viewer moves around, parts of the file are paged from disk into the cache. By default, the cache is 32 megabytes, which is allocated up front. If you are using high resolution terrain or the terrain appears blurry, try increasing the cache to 64 or 128 megabytes as shown below.
sceneManager.GlobeInlaySettings.TerrainCacheSize = 128;
It is not recommended to go above 128 megabytes. Large cache sizes can slow down rendering since so much terrain will be rendered.