# Sandbox.Terrain

Terrain renders heightmap based terrain.

- Kind: class
- Namespace: `Sandbox`
- Assembly: `Sandbox.Engine`
- Inherits: [Sandbox.Collider](/api/Sandbox.Collider)
- Modifiers: sealed

## Constructors

- [`Terrain`](/api/Sandbox.Terrain/.ctor)

## Properties

- [`Attributes`](/api/Sandbox.Terrain/Attributes): Attributes that are applied to the terrain based on the current material and shader. If the terrain is disabled, the changes are deferred until it is enabled again. Attributes are not saved to disk, and are not cloned when copying the terrain.
- [`ClipMapLodExtentTexels`](/api/Sandbox.Terrain/ClipMapLodExtentTexels)
- [`ClipMapLodLevels`](/api/Sandbox.Terrain/ClipMapLodLevels)
- [`ComponentVersion`](/api/Sandbox.Terrain/ComponentVersion)
- [`ControlMap`](/api/Sandbox.Terrain/ControlMap)
- [`EnableCollision`](/api/Sandbox.Terrain/EnableCollision)
- [`HeightMap`](/api/Sandbox.Terrain/HeightMap)
- [`IsConcave`](/api/Sandbox.Terrain/IsConcave)
- [`MaterialOverride`](/api/Sandbox.Terrain/MaterialOverride)
- [`RenderType`](/api/Sandbox.Terrain/RenderType)
- [`Storage`](/api/Sandbox.Terrain/Storage)
- [`SubdivisionFactor`](/api/Sandbox.Terrain/SubdivisionFactor): How many times to subdivide each block mesh (1 = one vertex per heightmap texel). Higher adds displacement detail at the cost of more vertices.
- [`TerrainHeight`](/api/Sandbox.Terrain/TerrainHeight): World size of the maximum height of the terrain.
- [`TerrainSize`](/api/Sandbox.Terrain/TerrainSize): Uniform world size of the width and length of the terrain.

## Methods

- [`Create`](/api/Sandbox.Terrain/Create): Call on enable or storage change
- [`GetMaterialAtWorldPosition`](/api/Sandbox.Terrain/GetMaterialAtWorldPosition): Gets terrain material information at a world position. Returns null if the position is outside terrain bounds.
- [`RayIntersects`](/api/Sandbox.Terrain/RayIntersects): Given a world ray, finds out the LOCAL position it intersects with this terrain.
- [`SyncCPUTexture`](/api/Sandbox.Terrain/SyncCPUTexture): Downloads dirty regions from the GPU texture maps onto the CPU, updating collider data and making changes saveable. This is used from the editor after modifying.
- [`SyncGPUTexture`](/api/Sandbox.Terrain/SyncGPUTexture): Updates the GPU texture maps with the CPU data
- [`UpdateCollision`](/api/Sandbox.Terrain/UpdateCollision): Update the collider heights/materials from the current CPU data for a region.
- [`UpdateMaterialsBuffer`](/api/Sandbox.Terrain/UpdateMaterialsBuffer): Upload the Materials buffer, this should be called when materials are added, removed or modified.
