Sometimes you need to use a texture as a scaling guide when building a structure, this little node set allows you to use the “box” uv mode in world space. Another issue of “box” mode, is that if you like sharp pixels on your guide textures, you’ll notice that using “Closest” prevents your textures from repeating properly.
So here is a little node graph (which i just keep inside a group) that will correct the UVs that are fed into your texture.
Now all you have to do is plug that node into your texture UV node. And it’s done!
Explanation on what’s exactly going on with this:
When setting a texture to use “box” uvs & and “closest” for the filtering, it causes a weird behavior where the texture will only accept uv values that are within the standard UV space (0.0-1.0).
- Separate the position components X Y Z
- Add 1000 (or any other round value) to each of the position components (this prevents them from being negative… at least up to -1000 meters)
- Modulo the result by 1 (constraints the result to a repeating 0.0-1.0 value space).
- Recombine X Y Z into a vector.