Repeats, Offsets, Hellish Maths!

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.

Continue reading “Repeats, Offsets, Hellish Maths!”

Follow

Get the latest posts delivered to your mailbox: