Grass Shading Issue

This is my material setup. I wanted to make simple grass that accepts shadows. Something like this I guess

This is how the grass looks from one angle which is somewhat close to what I’m aiming for.

This is what it looks like from another angle. This is not what I want.

Here are the normals(the ones in green) of the grass patch

I was always told that on grass the normals should face up but when I did that this is what I got from every angle

Can someone explain what I’m doing wrong? All I want is just simple looking grass.

Any answers/advice would be greatly appreciated as I am at my wits’ end with this grass.

Make sure you are using a normal map with the 2 sided foliage shader, even if it’s just blank.

Normals should not “always face up”.
The normals at the base of the grass should face up so they match the normal of the surface they’re sitting on better. The normals at the top of the grass should match the direction of the grass surface.

Also what ZacD said.

Adding a blank normal map didn’t make any difference.

I checked the world normal buffer visualization and the grass with the normals facing straight up are yellow/purple and stay that way no matter what angle you view from. Don’t know if its relevant but I thought it was interesting.

Changing the grass from 2 sided foliage to default lit doesn’t make much of a different in terms of the shading issue. Everything just gets darker.

Oh, sorry, try this.

Here is what the grass looks like with the flat normal map, vertex normals not facing up, and the 2sidedsign in the normal slot.

Here it is with the 2 sided sign stuff and the normals facing up

And here is the grass with a blank normal map WITHOUT the 2sidedsign and Without tangent space normals.
When tanget space normals are disabled I no longer get that weird shading where the back faces are really dark or really light and it starts to somewhat resemble the grass you see here:

This doesn’t seem like a good way to achieve that effect though


Here are the meshes I’m using just incase there is something wrong with them.

Could also try plugging a constant into Opacity (I guess a value of 1 just to see the difference).

Doesn’t 4.8 come with the ability to sample the underlying landscape diffuse colour so that it would be possible to blend the grass colour to match it better?

Here is the grass with opacity set to 1, tangent space normals on. It made no difference as far as I can tell.

Right now I am applying the same colors to my grass and terrain using the same variation texture but when that comes out Ill probably end up using that. I saw something like that in the open wold kite demo thing.

You can already do that.


By mAlkAv!An

Thats basically what I have set up right now except unlike mAlkAv!An I’m not using a specific landscape texture so I dont need to subtract the landscape position from the world position or anything like that.

I don’t think that really counts as dynamically sampling the underlying color which is what jonimake seems to be describing.

So what happens when you paint additional terrain layers?

Nothing. His system uses a single texture to represent the entire landscape anything that is painted wont show up in the grass.

I used the grass from the open world example just to rule out an issue with my material. Here is the grass from the example content:

Here is how my grass material looks on the new mesh. The material includes the 2sidessign and a flat normal and tangent space noramals are on. This is how the grass should have looked on my mesh with the normals facing up:

This is what you said:

And the graph I posted blends the underlaying diffuse color of the landscape to the grass. (if you have used a base color/diffuse at all). It’s not for sampling every individual layer you’d paint.

You wouldn’t even want your grass to match all of your paint layers. Your grass shouldn’t take the color of your dirt/gravel/cliff or whatever other textures you paint.

That’s not really sampling landscape diffuse colour, it’s just using world space UV coordinates for some texture and using that.
In 4.8 the landscape renders out a complete landscape texture, but I don’t know how to incorporate it into materials yet.

Where did you see that? I want to read more about it. That sounds super useful but I can also see and issue with the grass taking on the color of dirt, rocks, sand, or whatever else you paint unless there is a way to mask out certain layers.

There is a way to mask it. There’s a “landscape grass” node that works with the new procedural grass foliage type. They talked about it in the open world making of video. Basically the node is an additional output node that outputs a grass density multiplier on the landscape. How you calculate the density is up to you.