2014-12-27

Texture shuffle script

As I've mentioned before on this blog, I do quite a lot of building using Mesh Studio. In some cases the thing I'm building requires the careful lining up of textures on the various faces of the prims that will make the final object, in others it's not so important. With the latter builds, especially those that are designed to look like they're made of wood, I make a point of "randomly" messing with the texture offsets and the repeat sign (as in: the flip of the repeat) to try and make the texture look a bit more varied when I'm really using just the one texture.

So, given something like this:


I'll get rid of that very regular pattern by going through every face and changing the relevant values until it all looks a bit mixed up. The thing is though, in a very large linkset, that can get really boring. Sure, there's a certain meditative quality to doing a repetitive task like that again and again and again but... sometimes, just sometimes, you want to get on with actually building the damn thing.

Last night, as I headed for bed, I had one of those "why the hell didn't I think of that before?!?" moments. The idea that popped into my head was that I should write a really simple script that'll do the job for me (and likely do a better job of it than I do). So, this morning, I fired up the code editor and knocked it out.

Now I can drop a script in an object like that above, touch a face that matches the faces I want shuffled, and the result is this:


Or, if I don't like it, I can touch it again and get a different random arrangement. Or another. Or... you get the idea. And, of course, if I decide that one or two faces could do with a better tweak I can remove the script and finish it off by hand.

Here's the script in question:

1 comment: