SpeedTree
    Show / Hide Table of Contents

    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.

    Copyright © 2023 Unity Technologies
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX.