9 slice does the same, are you specifically after a pure material solution?
Well yes, it’s a texture solution - 9 slice.
Check the Setting Images States section in the above link - 9-slice is an automatically expanding border that preserves edges. Essentially what you’ve described but it’s a simple texture rather than an, arguably, expensive material.
Please help a math cripple in need
I want to make a material function that returns a value between 0…Max…1 depending on UV value and some other variables.
I’m pretty sure I could figure out, if I had the power of code at my disposal, but the material editor lacks even the most basic bool-operations and I quickly lose track of what I’m doing when I start putting "if"s together and whatnot.
I think it’s best explained with pictures. 0 is the outer edge where the border should fade out completely. 1 is the alpha at the center (factor 1, so it doesnt change from the brush). Max is the boost-factor that gets applied at the core of the border.
I want to make this a material function, so I can easily re-use it and modify it to work with colors instead of alpha etc.
On the second picture, I don’t really know what I’m doing anymore, but the first should make a lot of sense…
Forgot to mention, but it probably goes without saying that I want to create round corners. The edges are ok.
What other solution is there?
If you mean a texture-solution, I’d prefer material.