# Grass Editor

The **Grass Editor** in the GEM RTS Engine is used for adding and editing **grass cover** on a map's surface. The **grass cover** consists of **grass pools**.

A **grass pool** is a surface layer containing grass objects derived from one or more **grass patterns**. \
Grass Editor enables the creation of unique settings for each grass pool. Overlapping grass pools increase the density and diversity of grass cover in overlapping areas.

To access the Grass Editor, open the `Grass` tab in the **Landscape Editor**.

## **Grass Editor interface elements**

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F5qL7CGW5KO8BsGdiTpQv%2Fgrass%20editor.webp?alt=media&#x26;token=434cc65c-0db0-46d6-a986-0fdd34cbf49e" alt=""><figcaption><p>The <code>Grass</code> tab in the <strong>Landscape Editor</strong>.</p></figcaption></figure>

1. Sliders for adjusting the `Grass` brush.
2. The **grass pool list**.
3. Buttons for managing the **grass pool list**.
4. Modifier settings window for the selected **grass pool**.
5. The **grass patterns list**.
6. Scene editor.

Grass cover creation, editing, and deletion occur in real-time using the `Grass` brush on the scene.

## The Grass brush settings

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FqJLSV3341xXgCNh2K1Dr%2FGrass%20Brush.png?alt=media&#x26;token=96515cae-478b-4346-9304-da9a920af405" alt=""><figcaption></figcaption></figure>

* The slider `Sharp`/`Soft`: adjusts the blur level of the drawing area’s boundaries.
* The slider `Slow`/`Fast`: controls the rate of grass object addition during drawing.
* `Grass` brush size is adjusted using the `+` (Plus) and `-` (Minus) keys.

## **The Grass pool list**

The list displays the names of all grass pools used in the current map. The name of the selected grass pool is highlighted and comprises:

* pool type name;
* short description.

Example: `grid ‘grass green’`

* `grid`: pool type name.
* `grass green`: description.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FJNp2KP58f1UToyULwMwQ%2FGrass%20Pool%20list.png?alt=media&#x26;token=53bb3088-a53f-4383-8b3e-f1daf6911bb7" alt=""><figcaption><p>The Grass Pool list</p></figcaption></figure>

To highlight the grass objects' locations on the map for the selected pool, hold the `Shift` key.

### **The Grass Pool list management buttons**

* `Add`: adds a new pool.
* `Delete`: removes the selected pool.

{% hint style="info" %}
Currently, only the `grid` pool type is supported. \
Procedurally generated pools may be added in future updates.
{% endhint %}

### Grass Pool modifier settings

Each grass pool has a set of modifiers that influence the grass cover's appearance. \
These modifiers adjust pool parameters and grass object spawning during brush use.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FjeyAW2fwQY43mMFSu0PN%2FSetting%20up%20Grass%20pool%20parameters.png?alt=media&#x26;token=fd24c81f-410c-413e-9155-5b758b4bc06f" alt=""><figcaption><p><strong>Modifiers configuration window</strong></p></figcaption></figure>

The modifier window opens when a pool is selected or newly created.

<table data-header-hidden><thead><tr><th width="190">Modifier</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>Contains the pool's code name or brief description. <br>Example: <code>'grass fields'</code>.</td></tr><tr><td><code>cell size</code></td><td>Sets the grid cell size for grass placement density. <br><strong>Editable only for empty pools.</strong></td></tr><tr><td><code>rotation</code></td><td><p>Adjusts the grid angle, enabling placement on arbitrary angles relative to the ground surface layout. </p><p><strong>Editable only for empty pools.</strong></p></td></tr><tr><td><code>scale_range</code></td><td>Specifies the range for scaling grass objects during brush use, applied randomly within the range.</td></tr><tr><td><code>spreading</code></td><td>Defines grass object offset from grid nodes. A value of <code>0</code> places objects strictly at nodes, useful for creating aligned patterns like "furrows."</td></tr><tr><td><code>strict_angle</code></td><td>Regulates object placement on slopes. <em>(Disabled in the current version.)</em></td></tr></tbody></table>

## The Grass Patterns list

The `Patterns` window displays available templates for the `Grass` brush. The name of the selected pattern is highlighted.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FudsLCxAxmoHVHMUzvyXz%2FGrass%20Patterns.png?alt=media&#x26;token=2840728e-52b6-425a-82fa-c9b33a3a277e" alt=""><figcaption><p>The pattern <code>plant_3</code> highlighted as the selected option for drawing grass cover</p></figcaption></figure>

{% hint style="info" %}
The description of the Grass Patterns list is in the file `scene/set/grass.set`
{% endhint %}

{% hint style="success" %}
Grass models in templates feature:

* Support for various materials.
* Shadow casting and self-shadowing.
* Interaction with "wind."
* "Burning" functionality.
  {% endhint %}

## Grass brush operation

* **LMB**: adds grass per the selected pool and template parameters.
* **RMB**: removes grass cover from the selected pool.

The grass pool's modifiers are applied when spawning grass objects during brush usage.

### **Recommendations:**

1. Use different templates to create a natural and diverse landscape.
2. Customize pool modifiers for specific tasks, e.g., dense forests, sparse meadows, or neatly aligned crop rows.
3. Combine grass cover with other elements like trees and shrubs for optimized and realistic scenes.

### Working algorithm with the Grass brush

**Adding grass:**

1. Add a new pool or select an existing one.
2. Configure grid parameters (`cell size`, `rotation`) for empty pools.
3. Set modifiers for grass models (`scale_range`, `spreading`).
4. Choose a grass template from the `Patterns` list.
5. Use `LMB` to draw or click on desired areas.

{% hint style="info" %}
Repeat steps 3–5 for different templates and adjust parameters as needed.
{% endhint %}

**Removing grass:**

1. Select the required grass pool.
2. Use `RMB` to erase grass from specific areas.

{% hint style="danger" %}
Deleting a grass pool removes all associated models from the map.
{% endhint %}

{% hint style="warning" %}
When designing maps, it is important to consider that the presence of grass cover impacts performance and to use various optimization methods to prevent FPS drops.
{% endhint %}

## Best practices for realistic landscapes

To achieve the most realistic perception of the map's landscape, it is important to apply a comprehensive approach, using several tools from the Map Editor:

* [**Materials Editor**](https://bestway-1.gitbook.io/documentation/editor/map-editor/3-landscape-editor/material-editor)
* [**Color Editor**](https://bestway-1.gitbook.io/documentation/editor/map-editor/3-landscape-editor/color-editor)
* **Grass Editor**
* [**Entity Editor**](https://bestway-1.gitbook.io/documentation/editor/map-editor/2-entity-editor) to complement the surface texture patterns with map entities like stones, flora, and other ambient objects.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXfgGCiABrBVtujl8YSH9TI69dQLQYXP5SPpfMRhPV45svuzwQYmzSG40FRKuAfLZ5HYvqRxE11l-f8tKna13ZhFeQEKTl6epbF3QSXd4UM2YGdr4Zk7XAO7K3tGZEh_iLH7tHLLjbqeoAxmOqbUNOYLoGQ3?key=mT02MhWvds0bP5JA9s1VjA" alt=""><figcaption><p>Example <strong>of successful grass used on the arena_polesie map</strong></p></figcaption></figure>

**Natural grass cover:**

* Use overlapping pools with varied densities for realism.
* Combine short, tall, or dry grass patterns for natural effects.
* Avoid grass in areas dictated by narrative or map design.

**Maintaining visual integrity:**

* Use the `Color` brush for distant areas where grass rendering is disabled for optimization.
* Adjust terrain and grass cover hues to blend transitions and maintain consistency.

**Combining elements: textures, map entities, Grass brush, Color brush**

* Adjust terrain textures or vertex colors for seamless integration.
* Add objects like tall grass, stones, or shrubs for a lively environment, aligning with the map’s style and logic.

Using the Grass Editor in combination with other tools allows for creating detailed and visually appealing game maps, significantly simplifying the process of adding and configuring vegetation.
