Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

offset in planar mode?

Sardonicus Jacobus
Registered User
Join date: 5 Feb 2007
Posts: 128
09-12-2009 12:23
Hello,

Is there a way to figure out what my H or V offsets need to be on prims of different sizes using planar textures? In other words, If I have a checkerboard pattern on a 10x9.5 prim and a 9.5x8.25 prim, is there a way to get the textures to line up? I am terrible at math so please bear with my slowness. :)

Thanks in advance!
Matt
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
09-12-2009 12:44
There may be a clever way to do the math, but I haven't found it. It may not be elegant, but I've just matched textures in planar mode by trial and error and usually had very little trouble. It's tough to see in the photo at https://www.xstreetsl.com/modules.php?name=Marketplace&file=images&ItemID=1654689, but the roof shingles around the end of the platform on this rail depot match well. The pointy end section is a single cut and hollowed prim, textured in planar mode, and I matched it to the sides of the roof purely by eye.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
09-12-2009 14:35
The math is actually rather simple. The offsets are still a percentage of the texture canvas, whether you're using planar or standard mapping. So if you want to span a single texture across two equally sized faces, the offsets will be .25 and -.25, always. If you want to span it across three, it's going to be .333, 0, and -.333. Etc. Of course, for unequally sized faces, the actual calculations get a little more complicated, but the principle never changes.

The only relevant difference between planar and standard mapping is in calculating how the repeats in order to cover the whole object. And it's a very slight difference at that.

For planar, first you need the size of the entire object, or group of objects you need to cover. Then take the reciprocal of that number, and you've got your repeats per meter. For example, to cover a 20-meter object once, the repeats per meter would be .05. From there, it's just a simple matter of percentages to determine all the offsets.

For standard mapping, it's basically the same, except you need to apply the percentages twice: once to determine the repeats per face for each part, and then a second time to calculate the offsets.

If you'd rather not do the math yourself, there are plenty of scripted solutions on the market that can make it a bit quicker. TexFix and TextureAlign are two that I have. There are many more.

I'd also recommend you apply a test pattern grid to your surfaces, to make it really easy to see how the numbers fall. In the one I use (which I made available for free at /109/45/214824/1.html), each gray square is exactly 1% of the texture. Each numbered block along with its neighboring empty block, contain 10 squares, or 10% of the total texture width. This makes it really easy to see at a glance precisely how close to alignment your offsets are.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Larrie Lane
Registered User
Join date: 9 Feb 2007
Posts: 667
09-13-2009 03:31
The maths part as mentioned is quite simple.

Repeats; prim size / texture size * 1000
offset;
prim 1 = repeat / 2 - 500
prim 2 = repeat / 2 + 500

So to put it in real terms lets take 2 prims that have total length of 4.75 and each prim is 2.375 long

the formula for the first prim (left prim)
repeat: 2.375 / 4.75 = 0.5 * 1000 = 500
offset: 500 /2 = 250 - 500 = -250

2nd prim (right prim)
repeat: 2.375 / 4.75 = 0.5 * 1000 = 500
offset: 500 /2 = 250 + 500 = 250

Note; when entering the repeats and offsets using these formulas you need to enter them in SL after the decimal point. So 0.500 repeat and -0.250 offset.

The formula for offsets on multiple prims can also be found but the formula above will always be the same for the first and last prim in a sequence, the other prims require an additional formula for their offsets.

For Planar the formula is actually much simpler to find the repeats than default mapping.

the formula is;

10 divided by overall size multiply by 100.

the overall size is the total size of the prims/wall or area to be textured.

so for example a 25 metre wide wall by 12 metres high;

10/25=0.4*100=40 (input this as 0.040 Horizontally)
10/12=0.833*100=83.33 (input this as 0.083 Vertically)

One advantage of using Planar to texture multiple prims is that all prims in the set will have the same repeats regardless of size when applying the same texture. With default mapping you would need to find the repeats for all prims that were different in size.