To be honest I didn’t understand almost any of that, but before you posted that I managed to do it, perhaps it’s the exact same thing you’re talking about, but I’ll dumb it down for noobs like me that want to achieve this. Also I have a new question at the end.
I went to the UV editor and just created a new blank image, black, set the terrain to use that new image as a usual image texture, then I went in the node editor and added two texture nodes, stone and sand (and on the left I added a “resizer” for the textures, to make them smaller/repeat more times, you can skip this part, but you’ll get way better results with it), then I connected it like this (image below) and now if I want to paint sand, I go to the UV editor and paint* pure white color on the black image, if I want the stone, I just paint black color. So I don’t paint using textures in the paint editor, I just paint with black or white, each one corresponding to a specific texture. If I choose grey, then you get a mix of those 2 textures.
*The standard paint editor (in Cycles at least) apparently doesn’t do this automatically, so just paint with the paint editor inside the UV editor section.
The amazing thing with this method of texturing is that you don’t need large images at all, the terrain face I painted on is large, 20 meters by 20 meters (the white object is high as a human for reference) and the black texture I’m painting on is just 256x256 pixels, which is insane! To achieve the same pixel density without using this method, you would need at least a 4k, maybe even 8k texture for a face this size, yet I got a even better result with just 256x256! The sand&stone textures aren’t really on the image, so they are HD regardless of what image size you use for the (alpha?) black image.
The nodes
(as I said, the white thing is a human, around 5’ 8’’ or 175 cm)
Buuuut, now I have a new question, how do I know if it’s the sand that uses the black color or white color, or does the stone use black/white? More importantly, if I want to have 3 colors and a RGB system to do this, how do I select which color is responsible for what texture?
Also, bonus question, if I want to export this to Unity, Unreal,etc, then I export the mask image (“black one”) along with the textures, right?