Hi, so I have only a small experience level with shaders in any language, and none in Unity. What I am trying to do is turn a 2D array (of booleans or floats) into the Alpha Mask Texture for a shader that already uses a static alpha mask.
Here is the high level overview of what I’m trying to do: programmatically create a Alpha Mask Texture that will change over time (as the user touches the texture, it modifies the alpha in that area), and apply that alpha mask that sprites shader.
So here’s where I am now: I have my 2D array of booleans with the same width and height as my texture.
I think I can do something like this to set the alpha mask dynamically:
mySprite.renderer.material.SetTexture(“_AlphaTex”, myAlphaRenderTexture);
but I need help creating the RenderTexture myAlphaRenderTexture object…Some but not all of the pixels in this texture will be modified every frame, so I’d like the texture to persist and easily and arbitrarily access any pixel in the texture, and I don’t want to have to recreate the texture each time I want to change the mask.