How do I actually scale a material?

Please don’t tell me to use a texture coordinate. That *tiles *a material at a smaller scale. I have a dynamically generated material that I want to make smaller or larger but without changing its center. In this case I have a mask. I need to change the size of the mask relative to the percentage a task is done. This is for UI not surface work.

Why scale material? Why not scale the UImage/Brush which you have that material applied to (if that is for UI?)

There should be a material function, called ScaleUVsbyCenter, that scales texture coordinates and offsets them to compensate.

Initial solution found.

Because in this case it’s being used as part of a much larger material calculation as an image mask. I specifically said “I need to change the size of the *mask”. *This is not a final output brush. I’m quite aware how to resize the final material.

I did find a solution though. Ironically it still uses a Texture Coordinate (I’m writing these steps from memory). This solution is based on a scalar size input clamped between zero and one inclusive; that is a percentage from 1 (full original size) to 0 (shrunk to non-existence). The values used here are what I’ve found to work from experimentation; individual results may vary. If you are using a texture you need to set it from “Wrap” to “Clamp” in its properties. The usage of the “If” node is to eliminate the odd “crosshair” effect that appears. If anyone knows a better way to remove those please reply. The texture used here is just for testing.


to avoid that crosshair issue you need to make sure that the pixels at the edge are all black. possibly even with a padding of more than 1 pixel. not sure if the clamping happens before or after the mip-mapping.