# Removing grass and small foliage

## Summary

**Published:** Mar 18 2025 by [justarandomguyintheinternet](https://github.com/CDPR-Modding-Documentation/Cyberpunk-Modding-Docs/commits?author=justarandomguyintheinternet)\
Last documented update: Jul 08 2025 by [mana vortex](mailto:undefined)

This guide shows how to selectively block small foliage such as grass and pebbles, which is generated at runtime for terrain.

### Wait, that's not what I want!

If you would rather edit other objects: don't. [Remove the original](/cyberpunk-2077-modding/modding-guides/world-editing/removing-objects/world-editing-deleting-objects.md), then spawn your edited object in the same spot.

## Requirements

* WolvenKit
* MS Paint
* [RHT](https://github.com/psiberx/cp2077-red-hot-tools)

## Finding the terrain mesh

* First, find the `worldTerrainMeshNode` on which the foliage resides, using RedHotTools
  * To make this easier, go to the settings tab of the World Inspector window, and set "Show Marker" to always
* Copy the mesh path clipboard by middle-mouse-button clicking it

<figure><img src="/files/hySOquXD7ItKiQA7Z0iE" alt=""><figcaption><p>Locating the right terrain mesh node, made easier by forcing markers to always show</p></figcaption></figure>

## Extracting files in WolvenKit

* Now, add the mesh file to your WolvenKit project
* Open the mesh file
* At the top of the mesh view window, you will see a collection of "CBitMapTexture / Texture Preview" headers

  * Locate the `CBitMapTexture` which when hovered shows the file-name `...foliage.xbm`
  * Right click it, and select "Extract Embedded File", and chose a location to save it too (Default is fine)

  <figure><img src="/files/lxbhQvV1wJBIS7qiKPaR" alt=""><figcaption><p>Find the one which is a BW texture, and the corresponding CBitMap texture one, which is named <code>...foliage.xbm</code></p></figcaption></figure>

  <figure><img src="/files/H3pY4Z8zhwx6zhceGwGG" alt=""><figcaption><p>Right-Click the CBitMapTexture one, and select extract</p></figcaption></figure>

{% hint style="success" %}
This texture is used as a mask, to block foliage spawned at runtime based on various other embedded masks, appearing in certain spots

Try and figure out which part of the texture corresponds to what part of the world
{% endhint %}

{% hint style="warning" %}
Some terrain cell meshes (mostly out of bounds) do not have a foliage mask by default.\
If this is the case :

* Open a cell that already has a foliage mask.
* Right-click and copy the following entry :\
  **preloadLocalMaterialInstances → Values → CKeyValuePair MaskFoliage**
* Paste this item into the target cell in its **preloadLocalMaterialInstances → Values**.

You may also use the source cell’s **foliage CBitMapTexture** as a template before continuing with the tutorial.

**Important:** remember to set a custom path for your `.xbm`.
{% endhint %}

## Finding the right part

* Now you must figure out what part of the texture to edit, to do this try and map the texture to the game world
* E.g.

<figure><img src="/files/Vr5fYL74dhPxP5crGtHV" alt=""><figcaption></figcaption></figure>

## Editing Texture

* Export the `.xbm` using WKit's exporter, as `.png`
* Open it in e.g. MS-Paint
* Paint the parts of which you want to remove the foliage black
  * Make sure you use full black, and do not end up with grayscale pixels
* Re-import the texture into WKit

## Make the terrain use the custom texture

* Now, make the terrain mesh use your custom foliage mask texture, as follows:

<figure><img src="/files/cHq2IvQiez6i1BgobqQA" alt=""><figcaption><p>Change the <code>MaskFoliage</code> of the terrain mesh' <code>perloadLocalMaterialInstances</code> to point to the modified foliage mask</p></figcaption></figure>

{% hint style="warning" %}
Make sure you set the Flags of the `Value` is set to `Default`
{% endhint %}

<figure><img src="/files/e3TlUiMrAp1oaCuIfbVn" alt="" width="563"><figcaption><p>Make sure this is set to default</p></figcaption></figure>


---

# 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://wiki.redmodding.org/cyberpunk-2077-modding/modding-guides/world-editing/removing-objects/removing-grass-and-small-foliage.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.
