meta data for this page
  •  

Terrain system rendering

For rendering the terrain system, you have two choices: i) use the built-in terrain rendering system, or ii) render it yourself. This section outlines how to use the built-in rendering system.

CMyTerrainRenderer

To get started, call CMyTerrainRender:InitGfx() during initialization. This function is similar to CMyTerrain::Init(). The CMyTerrainRender class is derived from CMyTerrainEngine and will call CMyTerrainEngine::Init() internally.

st_bool CMyTerrainRender::InitGfx(st_int32                 nNumLods,
                                  st_int32                 nMaxTileRes,
                                  st_float32               fCellSize);

Descriptions for the function parameters can be found on the Terrain system overview page.

Graphics initialization

Initialize the rendering attributes by calling CMyTerrainRenderer::SetRenderInfo(). It takes an STerrainRenderInfo structure that makes some assumptions about how terrain rendering will be done. Modifications will be necessary (and expected) when deviating from the example setup.

The example terrain rendering setup used by the reference application assumes that three diffuse textures are used, a splat map, and a normal map. See the example terrain shaders housed in the reference application for details about how these textures are used.