# ExportGrassAtlasTexture

### Export Grass Atlas Texture

```csharp
Texture2D ExportGrassAtlasTexture(int resolution, out Dictionary<Texture2D, Rect> atlasRect)
```

Packs all textures used by the grass objects stored inside [TerrainData](https://docs.unity3d.com/ScriptReference/TerrainData.html) object into a texture atlas.

*<mark style="color:blue;">atlasRect</mark>*  - Returns an array of rectangles containing the UV coordinates of each packed grass texture inside atlas, or null if packing fails.

The resulting texture atlas will be as large as needed to fit all grass textures but only up to *<mark style="color:blue;">resolution</mark>* in each dimension. If the grass textures can't all fit into a texture atlas of the desired size then they will be scaled down to fit.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://amazing-assets.gitbook.io/terrain-to-mesh/run-time-api/terraintomesh/exportgrassatlastexture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
