- Home /
Question by
Ending2019 · Apr 25 at 08:31 AM ·
terrainrenderinggrassmaterialpropertyblockreplacement shader
How do I set the MaterialPropertyBlock for terrain grass?
Hello,
I want to apply a replacement shader to the terrain grass and change the material properties using MaterialPropertyBlock. I've tested the SetSplatMaterialPropertyBlock function as the following code
var mpb = new MaterialPropertyBlock();
mpb.SetColor("_CustomColor", terrainColor);
terrain.SetSplatMaterialPropertyBlock(mpb);
The replacement shader works fine for terrain and grass. But, the _CustomColor only applies to the terrain but not grass. How do I set the MaterialPropertyBlock for terrain grass?
screenshot-from-2022-04-25-16-03-32.png
(11.6 kB)
Comment
Your answer
Follow this Question
Related Questions
How do you fix terrain grass getting darker with distance? 2 Answers
MaterialPropertyBlock ignored when rendering with replaced shaders? 0 Answers
Terrain grass invisible in editor 1 Answer
Unity terrain grass extremely weird 0 Answers
Grass not getting original texture, generating grass in a good way? and more 0 Answers