# Getting ground color for grass

**URL:** <https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109>\
**Category:** Rendering\
**Tags:** unreal-engine\
**Created:** [July 23, 2014, 8:21pm UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109 "2014-07-23T20:21:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![FatJoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FatJoe](https://forums.unrealengine.com/u/FatJoe)\
**Post date:** [July 23, 2014, 8:21pm UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/1 "2014-07-23T20:21:40Z")

</div>

Hi!

I’ve got a bit of a project going but I’m a complete beginner so my understanding on the material system is still pretty limited, though growing each day.

I’ve got an idea I want to try out, which is to set the base color for my grass on a piece of landscape, as the color of the terrain the grass is located on. As if the grass picks up the color from the ground. I could then apply detail texture on top of that, but the base color for it should come from the ground.

[http://joe.simnet.is/FH/proto/questions/PickGroundColor.jpg](http://joe.simnet.is/FH/proto/questions/PickGroundColor.jpg)

The thing is, I haven’t got a clue on if it’s possible or how I’d go about doing it. I’d appreciate any help, a nudge in the right direction?

Thanks!

---

<div class="post-metadata">

**Author:** ![fastcar25](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fastcar25](https://forums.unrealengine.com/u/fastcar25)\
**Post date:** [July 24, 2014, 2:36am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/2 "2014-07-24T02:36:38Z")

</div>

It’s certainly doable, CDProjekt is doing just that for The Witcher 3.

There is a presentation floating around on the net showing how they handled this.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6482f21d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6482f21d](https://forums.unrealengine.com/u/anonymous_user_6482f21d)\
**Post date:** [July 24, 2014, 3:13am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/3 "2014-07-24T03:13:37Z")

</div>

> [@FatJoe;102989](#):
>
> Hi!
> 
> I’ve got a bit of a project going but I’m a complete beginner so my understanding on the material system is still pretty limited, though growing each day.
> 
> I’ve got an idea I want to try out, which is to set the base color for my grass on a piece of landscape, as the color of the terrain the grass is located on. As if the grass picks up the color from the ground. I could then apply detail texture on top of that, but the base color for it should come from the ground.
> 
> [http://joe.simnet.is/FH/proto/questions/PickGroundColor.jpg](http://joe.simnet.is/FH/proto/questions/PickGroundColor.jpg)
> 
> The thing is, I haven’t got a clue on if it’s possible or how I’d go about doing it. I’d appreciate any help, a nudge in the right direction?
> 
> Thanks!

Oh, Good luck with that, just keep working on it and improve it more and more.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_857e6031](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_857e6031](https://forums.unrealengine.com/u/anonymous_user_857e6031)\
**Post date:** [July 24, 2014, 5:12am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/4 "2014-07-24T05:12:10Z")

</div>

Here’s the PDF for how CDProjekt is doing their terrain. Might give some guidance or help a light bulb appear above your head . It’s not a tutorial. I’m no pro myself so I’m interested in learning. They’re doing exactly what you want. Specifically detailed in the “Pigment Map” portion of the presentation. It’s certainly interesting and hopefully some experts chime in to help translate CDProjekt’s method into a BP method.

Anyway, the PDF link: [http://twvideo01.ubm-us.net/o1/vault/GDC2014/Presentations/Gollent\_Marcin\_Landscape\_Creation\_and.pdf](http://twvideo01.ubm-us.net/o1/vault/GDC2014/Presentations/Gollent_Marcin_Landscape_Creation_and.pdf)

---

<div class="post-metadata">

**Author:** ![Sitrec](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sitrec](https://forums.unrealengine.com/u/Sitrec)\
**Post date:** [July 24, 2014, 6:47am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/5 "2014-07-24T06:47:47Z")

</div>

I’ve done this both in UDK and UE4 so it’s certainly doable.  
I did it by having a color map that shows the variation in color throughout the landscape, I removed all unwanted colors like rocks, sand and such and only had variations of green and brown then I let that color my foliage.  
I’m not at home right now and it was a while ago so I don’t remember exactly but i found that Ülrich Thümmler did something similar here:

> **[UDK World Color](http://ulrichthuemmler.blogspot.com/p/udk-world-color.html)**
>
> \[UDK\] Worldposition Color Material  Tutorial zum Texturblenden auf  Static Meshes. Mattree für zufällige Farbposi...

 ![landscapematerial.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/f/cff25e38ae6b0bcd11e8cdebfaf74aefb5b19168.jpeg)

I can check when I get home exactly how I did it but that should get you going.

---

<div class="post-metadata">

**Author:** ![TimeSpirits](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TimeSpirits](https://forums.unrealengine.com/u/TimeSpirits)\
**Post date:** [July 24, 2014, 7:02am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/6 "2014-07-24T07:02:01Z")

</div>

That scene with all the colored grass looks great- I’m curious how it actually runs.

---

<div class="post-metadata">

**Author:** ![iniside](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/iniside/32/866315_2.png) [@iniside](https://forums.unrealengine.com/u/iniside)\
**Post date:** [July 24, 2014, 9:34am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/7 "2014-07-24T09:34:11Z")

</div>

There is something like that in CryEngine2/3, and there was no noticeable rendering cost for coloring grass to match underlying terrain color.

Though, my bet is, to make it really performance friendly, you would need to create custom shading model in HLSL, with access to Landscape textures info, and sample colors from here, to blend them over grass.  
A task, for someone, who is good at writing shaders and understands unreal rendering ;).

I’m not sure if material editor have enough information exposed to it, to make it work.

---

<div class="post-metadata">

**Author:** ![Ulrich.Thummler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ulrich.Thummler](https://forums.unrealengine.com/u/Ulrich.Thummler)\
**Post date:** [July 24, 2014, 12:04pm UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/8 "2014-07-24T12:04:39Z")

</div>

> [@;103368](#):
>
> That scene with all the colored grass looks great- I’m curious how it actually runs.

This sample scene run in udk with 120fps (460gtx). In UE4 is the same performace.

The important thing is to clone your landscape(ground) texture and set the mipmap to 128px or 64px.

You can expand the shader, for example, snow, autumn, rain, wind or alpha mask death trees.

---

<div class="post-metadata">

**Author:** ![FatJoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FatJoe](https://forums.unrealengine.com/u/FatJoe)\
**Post date:** [July 24, 2014, 1:10pm UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/9 "2014-07-24T13:10:01Z")

</div>

The Witcher 3 grass looks a bit like what I had in mind, after a quick glance, looks good as well. I think I understand what they did but need to read through it to form how I’d do it. The whole document seems like an interesting read actually, thanks for that!

Inside, yeah, Refractor 2 (Battlefield 2) had that same option, which is where I got the idea from to try this out.

Ülrich, great work on that grass, it looks fantastic! And gives me something to try out with the material, will be testing it tonight. Thanks for clarifying the numbers!

Thanks everyone for the help, I’m loving the helpfulness of this community! I’ll post an update on if I get it working!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_50a0b22d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_50a0b22d](https://forums.unrealengine.com/u/anonymous_user_50a0b22d)\
**Post date:** [July 24, 2014, 8:33pm UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/10 "2014-07-24T20:33:27Z")

</div>

The basic idea is to have a texture showing the base colors of the underlaying terrain. When using an external terrain generation software you might be able to export that texture from there. Otherwise you could to a top down render of your landscape in game or editor.

Once you got the texture it’s all about sampling it properly in the grass material to match the actual landscape size and position:

 ![5d9cb8f3f474309dabffb2e57379d57517a26265.jpeg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/5/d/5d9cb8f3f474309dabffb2e57379d57517a26265.jpeg)

---

<div class="post-metadata">

**Author:** ![Boompit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boompit](https://forums.unrealengine.com/u/Boompit)\
**Post date:** [August 26, 2014, 5:15pm UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/11 "2014-08-26T17:15:15Z")

</div>

> [@;103869](#):
>
> The basic idea is to have a texture showing the base colors of the underlaying terrain. When using an external terrain generation software you might be able to export that texture from there. Otherwise you could to a top down render of your landscape in game or editor.
> 
> Once you got the texture it’s all about sampling it properly in the grass material to match the actual landscape size and position:
> 
> ![5d9cb8f3f474309dabffb2e57379d57517a26265.jpeg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/5/d/5d9cb8f3f474309dabffb2e57379d57517a26265.jpeg)

Noob here ☹ How do I make a top down render of the landscape?

---

<div class="post-metadata">

**Author:** ![Kuro1n](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kuro1n](https://forums.unrealengine.com/u/Kuro1n)\
**Post date:** [August 26, 2014, 8:54pm UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/12 "2014-08-26T20:54:27Z")

</div>

Switch from perspective camera to top.

---

<div class="post-metadata">

**Author:** ![Boompit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boompit](https://forums.unrealengine.com/u/Boompit)\
**Post date:** [August 27, 2014, 9:33am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/13 "2014-08-27T09:33:07Z")

</div>

> [@Kuro1n;126779](#):
>
> Switch from perspective camera to top.

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![sanford87](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sanford87/32/906597_2.png) [@sanford87](https://forums.unrealengine.com/u/sanford87)\
**Post date:** [November 7, 2014, 8:36pm UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/14 "2014-11-07T20:36:01Z")

</div>

has anyone figured out a way to actually get the color from the terrain? if I take a picture from up top and then I repaint something on the terrain I’ll have to start over.

---

<div class="post-metadata">

**Author:** ![TimeSpirits](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TimeSpirits](https://forums.unrealengine.com/u/TimeSpirits)\
**Post date:** [November 8, 2014, 5:01am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/15 "2014-11-08T05:01:45Z")

</div>

> [@sanford87;176039](#):
>
> has anyone figured out a way to actually get the color from the terrain? if I take a picture from up top and then I repaint something on the terrain I’ll have to start over.

I have a color overlay map on my grass tileset material, it tints the grass to give it variety. I then use the same map and scaling (world coordinates) on the grass model material.

This way wherever I paint my grass, it always matches the landscape material.

---

<div class="post-metadata">

**Author:** ![sanford87](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sanford87/32/906597_2.png) [@sanford87](https://forums.unrealengine.com/u/sanford87)\
**Post date:** [November 8, 2014, 6:22am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/16 "2014-11-08T06:22:12Z")

</div>

Is the “Terrain base color” a top down texture of your terrain? I’m curious how it updates when you paint on new layers. This is exactly what I need I’m just a little slow with the concept.

---

<div class="post-metadata">

**Author:** ![Havoc](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/havoc/32/88710_2.png) [@Havoc](https://forums.unrealengine.com/u/Havoc)\
**Post date:** [November 23, 2014, 11:40pm UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/17 "2014-11-23T23:40:34Z")

</div>

> [@sanford87;176220](#):
>
> Is the “Terrain base color” a top down texture of your terrain? I’m curious how it updates when you paint on new layers. This is exactly what I need I’m just a little slow with the concept.

Yes, the terrain base color is a manual render of your landscape. The render itself does not update automatically when you paint new layers. Switch to top down perspective and hide everything but your landscape, then update the texture as necessary.

---

<div class="post-metadata">

**Author:** ![Shrimperator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shrimperator](https://forums.unrealengine.com/u/Shrimperator)\
**Post date:** [November 24, 2014, 2:40pm UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/18 "2014-11-24T14:40:51Z")

</div>

, could you show how your materials look like? 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d699d730](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d699d730](https://forums.unrealengine.com/u/anonymous_user_d699d730)\
**Post date:** [September 16, 2015, 3:04am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/19 "2015-09-16T03:04:28Z")

</div>

Would also love a way to do this by just getting the landscape colour.

What is the node tagged as “LandscapeLocation(X,Y)”?

---

<div class="post-metadata">

**Author:** ![Sgt.Wulf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sgt.Wulf](https://forums.unrealengine.com/u/Sgt.Wulf)\
**Post date:** [September 16, 2015, 5:01am UTC](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109/20 "2015-09-16T05:01:41Z")

</div>

It’s not a special node. Those are your Landscape X,Y location coordinates of your landscape. Just copy those number and put in constant 2 vector.

[Next page](https://forums.unrealengine.com/t/getting-ground-color-for-grass/8109.md?page=2)
