M⁴ Documentation

  1. Home
  2. Docs
  3. M⁴ Documentation
  4. 🎨 Painting the Terrain (Customization)
  5. Adding Foliage to Your New Paint Layer

Adding Foliage to Your New Paint Layer

After we’ve created our custom paint layer (how to do that can be found here), then we may want to add procedural foliage to that paint layer. This foliage will automatically spawn anywhere the paint layer has been painted on the terrain. To do this, follow these steps.




Step 1:

Click on your Landscape, scroll down to where it says “Landscape Material” and double click the image to open up the Material Instance that it’s using.

Once the Material Instance is opened up, scroll down all the way to the bottom and double click the image to open up its Master Material.




Step 2:

Now that you’re inside the Master Material, go to where it says “Landscape Grasstype (Procedural Terrain Foliage)” and click on a node that says “Grass“.

This is where we will be adding our Paint Layer info to.




Step 3:

In the Grass node click the + icon and this will create a new slot for us to plug something into.

Name the slot the same thing that our Paint Layer is named.

Side Note: When we created a new Custom Paint Layer in this article, we named it “MyCustom” so we’ll stick with that for the example shown.




Step 4:

Now right click anywhere that there’s an empty space and type in “Landscape Layer Sample“. This will create a new node.




Step 5:

Name this new node whatever our Paint Layer Name is and connect it to the new slot on the Grass node.

Important note: it’s crucial that you name it the EXACT name of your paint layer, so that it knows which one to talk to.




Step 6:

We’ll now need to create a Landscape Grass Type file.

To do this, click on the Grass node again, then on the left, scroll down and click the drop down menu that says “None” on it – next to the input we made earlier.

Now click “Landscape Grass Type” at the top of the list.

This will create and assign the new file, save it wherever you want, and name it whatever you want.




Step 7:

We’re finished! click “Apply” at the top of the Material Editor to apply all of our changes.




Step 8:

To change what foliage meshes we want to spawn and their Density, rotation, etc. just open up the “Landscape Grass Type” that we created in Step 6.

Anything we change in there, will change on our custom paint layer. Enjoy!

How can we help?