I am attempting to create a surface shader that colors each surface a base color, with a border of a different color of a specified width. For example, with a _BorderWidth of 0.1F, each of a cube's six faces should have a 0.1m perimeter of the border color, with the center of each face being the base color.
I've been able to come close to what I seek, except the width is calculated in object space, no world space. If I scale a cube to be 2.0m on the x axis, the borders on the left and right sides of the top face are also scaled on the x. I've tried for a couple weeks now and have not succeeded in keeping the border width despite both scale and rotation.
If anyone has any tips or suggestions, I will greatly appreciate them. This is actually a task I've attempted on and off for a few years with various shader plugins and code, and I have yet to be successful.