# CopyActiveRenderTextureToHeightmap(RectInt, Vector2Int, TerrainHeightmapSyncControl)

> Copies the specified part of the active RenderTexture to the Terrain heightmap texture.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.TerrainModule

```csharp
public void CopyActiveRenderTextureToHeightmap(RectInt sourceRect, Vector2Int dest, TerrainHeightmapSyncControl syncControl)
```

### Parameters

**** (\[RectInt]\(/engine/6000.7/script-reference/unityengine/rectint)): The part of the active Render Texture to copy.**** (\[Vector2Int]\(/engine/6000.7/script-reference/unityengine/vector2int)): The X and Y coordinates of the heightmap texture to copy into.**** (\[TerrainHeightmapSyncControl]\(/engine/6000.7/script-reference/unityengine/terrainheightmapsynccontrol)): Controls how CPU synchronization is performed.

### Remarks

This functions calls [TerrainData.DirtyHeightmapRegion](/engine/6000.7/script-reference/unityengine/terraindata/dirtyheightmapregion.md) internally and sends out the OnTerrainChanged message accordingly.

The range of expected height values for the active [RenderTexture](/engine/6000.7/script-reference/unityengine/rendertexture.md) is between `0` and `0.5`. This is unlike [TerrainData.SetHeights](/engine/6000.7/script-reference/unityengine/terraindata/setheights.md), which expects height values between `0` and `1`.

Additional Resources: [TerrainHeightmapSyncControl](/engine/6000.7/script-reference/unityengine/terrainheightmapsynccontrol.md), [TerrainData.DirtyHeightmapRegion](/engine/6000.7/script-reference/unityengine/terraindata/dirtyheightmapregion.md), [TerrainData.SyncHeightmap](/engine/6000.7/script-reference/unityengine/terraindata/syncheightmap.md)
