Search Unity

Question Painting a mask texture on a terrain at runtime.

Discussion in 'General Graphics' started by Felyana, Sep 3, 2021.

  1. Felyana

    Felyana

    Joined:
    Apr 30, 2020
    Posts:
    5
    Hello everyone,

    I am working on a Grass/Ground terrain shader using a geometry shader.

    Currently the grass is rendering everywhere and I would like to have some sort of texture to hide grass where I don't want it. I was thinking of using a texture with RGB for the grass color and the alpha channel to hide it.

    I want to be able to "paint" grass like a unity terrain tool at runtime. I already know how to hide the grass using a texture, I just need to "paint" the texture.

    I was thinking of using some Raycast and a SetPixel() on a texture but I think it's quite ineficient.

    Is there a good way to do something like that?


    NB: I am using the Universal Rendering Pipeline.