So I’ve been working for a while on trying to figure out how the bloody hell you calculate offsets and repeats to make textures play nicely in Second Life when it comes to applying the same texture across multiple faces. There’s an alternative method, which involves using planar texturing and using the extremely useful align planar textures option. Planar texturing has an additional performance overhead but this is largely considered to be negligible, according to the mesh/rendering weight article on the official Second Life wiki.
However I decided to go the painful route of doing this with default texturing, which took me to maths hell! Seriously. I wanted to use three prims to make a total prim size of 14 metres, two of these prims were just side walls, so their edges would be showing on my front and back wall and then in the centre would be the main piece. The inital size of the prims I set as 0.200 for the edge walls and 13.600 for the main piece, this sounded nice. Now this would mean I’d have to adjust the texture repeats for the edges, as they would not need to have a horizontal size of 1.000, it won’t render nicely if I leave it like that.
One quick way to get a rough idea of how to do this is to to copy your main piece, then untick resize textures and resize it. However I wanted pinpoint accuracy, the way to get a more accurate size of your needed repeats is:
prim size/total building face size.
So for example in this case my first edge piece is 0.200m, the total building face size is 14 metres, so I divide 0.200 by 14, this is where the first Maths problem arose, 14 doesn’t divide nicely into 0.200, it comes out at 0.014285714285714285714285714285714, if I use the unticking stretch textures technique it would come out at 0.014, because it rounds down but that’s not pinpoint accuracy, for pinpoint accuracy you need your calculations to have no more than three decimal places.
Now I’ll admit that I winged it here, I just figured that 7 goes into 14 nicely, 7 also goes into 21, therefore I adjusted some decimal points and set my edge walls with a width of 0.210 and 0.210 divided by 14 comes out as: 0.015, which fits nicely into the three decimal places rule. Now I had to hope that the centre piece, at 13.580 metres would also be divided by 14 nicely, the result was: 0.970, hurrah! So now I can put the same texture on all three prims and it should tile nicely as if I’m using just one prim. This is when I ran into the next Maths problem, offsets, it wasn’t aligned nicely horizontally, I also decided that this texture looked a little stretched so I decided I wanted to get it to repeat twice, so I doubled my repeats so the edge walls were 0.030 and the main wall had a repeat of 1.940, this means the texture will tile twice horizontally across the whole 14 metres, but I still had the issue of alignment to deal with.
The challenge now was to position each texture face so that they align nicely, so that at the end of one prim, the start of the next texture is at that point. This stumped me, if you were using three prims of the same size it’s rather straight forward, -0.333 for the left, 0.000 for the centre and 0.333 for the right should be about right, but my prims are different sizes, I turned to the official forum for help! Kwakkelde Kwak came to my rescue and figured out the offset forumla for me, for which I am very grateful! The formula Kwakkelde figured out was:
Offset = 0.5 * [number of textures side by side] * [width of the left prim] / [width of all three prims combined] – 0.5
or Offset = 0,5 * Repeat – 0.5
I went with this formula, and found:
left prim offset = (0.5 * 0.030) – 0.5 which came out as -0.485
Now for my centre piece, the formula comes out at 0.470 but then I need to adjust this because it’s not starting at the same position, it needs to be 0.030 across, so that comes out at 0.500 and my final edge piece is the opposite of my left piece, 0.485. This worked nicely. If this doesn’t work for you in terms of where the texture starts and ends, once you’ve got the differentials sorted, you can move them horizontally.
There are easier ways, you may well figure out that it’s not worth the effort, in many cases the issue of alignment will be negligible and you won’t need super accuracy, you may decide that all this Maths gives you a headache and stick to planar texturing and use the excellent align planar textures tick box instead!
If you want hellish maths, try calculating rotations…
haha someone on twitter mentioned that, and quarterions!
You could always try Easy Texture from JexTone. Doesn’t cover all eventualities or shapes (it won’t handle curved surfaces or surfaces offset to the world axises, for example – but in the case of the latter, who in the world risks building off-axis?). But what it does, it does well and simply and efficiently, and requires far less use of the calculator. It allows fairly straighforward application of texture, complete with reps and rotations handled directly from the HUD. There *are* limitations here as well, but so far in 4 years of building, I’ve yet to encounter serious issues & have been saved a lot of headaches.