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.
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.
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:
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.
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!
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:
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.