I am trying to do something like paint program. There will be a background texture and a brush texture. I will pass the mouse input from the script to the shader and put the brush texture to the proper position of the main texture. How can I achieve this by using a shader because the performance is too low when I do it in the CPU.
I’m trying to do a similar thing but no chance… I tried setpixels method first with no luck and then find “soft brush” ( you can find if you search it) but that guy hasn’t given any code…So yeah, If anyone has any idea please share…
Anything you do is going to end up being a combination of shaders and game code. I used a texture as a mask against SetPixels on one of two “control maps” that are used to blend 8 textures in a shader.
My target isn’t mobile so I don’t know how well it would perform in such an environment. It’s also a fairly complicated solution
Essentially, here are the steps.
Get a texture with an alpha channel to use as a mask (or brush)
Use a mesh where the UV coordinates are spaced out evenly and cover the entire 0-1 range. (Imagine looking straight down at a plane.)
Use a shader that blends textures together based on a “control map” texture. Each RGBA value in the control map looks at a single texture. My solution in the video uses 2 control maps in order to get 8 textures instead of 4.
Thanks for the reply and sorry for my ignorance… I couldn’t understand the part about the “control maps”. Is there anywhere that i can find information about control maps? Or can you tell a little about control maps like what are they used for?