Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

How do you stack mask textures on a single diffuse?

Discussion in 'Shader Graph' started by Discipol, Jul 18, 2020.

  1. Discipol


    May 6, 2015
    Hi! I want to implement this effect in Unity through a Shader Graph:

    What happens is that there is multiple round-ish black & white textures that represents areas of burning ground. All of them are combined through Math.Max meaning if multiple are overlapping, it is clamped to 01 and they are merged into a single bigger blob mask.

    What I have tried is to feed a Texture2D Array to a Shader Graph with the intention of feeding the positions as offsets but the problem is that I can't iterate over an Array + there's no such thing as an array of Vector3.

    The second idea is to merge them via code. I make a huge mask texture which I fill with black, then iterate over each mini-blob and MAX the mask pixel with the miniblob pixels. Then I setpixels, apply, and should work. Right? Wrong. It's such an overhead that my game runs at 1 fps

    I must admit shaders are not my forte but I really want to make this work somehow.
    Does anybody have a fix for my attempts or perhaps a new approach?