> For the complete documentation index, see [llms.txt](https://tfg-bravoperezrubio.gitbook.io/cosmicarchitectdocumentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tfg-bravoperezrubio.gitbook.io/cosmicarchitectdocumentation/explanation-of-classes-and-components/foliage.md).

# Foliage

Responsible for the procedural generation of vegetation on the planet. It defines a data structure called a Foliage Collection containing the groups of meshes (models of plants or any type of object) that will be instanced. For each group, you can define the range of height, temperature, humidity, and curvature in which those models are instanced. Additionally, for each model, you can define the random rotation ranges applied when instancing them, the scale range, and the number of instances per square kilometer.

The Foliage Spawner Component manages 3 instancing layers: near, medium, and far. Models in the near layer can be rocks, grass, or weeds, and they will be instanced in an area close to the player. The medium layer and far layer can be used for trees and boulders that are instanced less frequently.

* Foliage Collection: A Data Asset that contains the information of the models the spawner will instance. You can create your own or use the one included with the plugin called Big Planet Foliage, which contains plant and rock models from the Engine.
* **Near Layer Radius Km:** The radius of the near foliage generation layer.
* **Medium Layer Radius Km:** The radius of the medium foliage generation layer.
* **Far Layer Radius Km:** The radius of the far foliage generation layer.
* **Max Instances Per Frame:** The maximum number of instances generated per frame. This has a significant impact on performance.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://tfg-bravoperezrubio.gitbook.io/cosmicarchitectdocumentation/explanation-of-classes-and-components/foliage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
