Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Maintaining Aspect Ratio or Texture Size?

XiangMei Xingjian
Registered User
Join date: 16 Sep 2005
Posts: 10
12-20-2005 20:42
Okay I tried searching & found nothing on this... Is there a way to apply a texture to a prim surface without SL automatically distorting it to fit the size of the prim? If I try to apply a square sized texture to a long rectangular prim it does not maintain the original aspect ratio & then I have to try figuring out the math to get it back. This is very annoying when trying to piece together many odd shaped prims to form a piece where the textured surfaces go together like a puzzle.
Robin Sojourner
Registered User
Join date: 16 Sep 2004
Posts: 1,080
12-21-2005 01:07
Hi!

If I understand you correctly, you want to place a texture which you uploaded as a square onto a rectangular prim, and have only part of the texture showing on that prim. Is that correct?

If it is, you've probably already found that if you disable "Stretch Texture" and then apply a texture, SL will assume that a single repeat of the texture should take .5 meters, and will automatically set the texture to that size. (I assume because .5 meters is the default Prim size.)

What you want to do is reset the base repeats, and the way you do that is through "Repeats Per Meter."

The fastest, easiest way I've found to do this is to leave "Stretch Texture" enabled while you build, so everything gets the default single Repeat on each face.

When you're ready to texture, create a cube the size of the largest dimension of your object. (For instance, if you have a square texture, and you want to use the bottom half on a prim that's 5.6m x 2.8 m, create a 5.6m x 5.6m x 5.6m cube.) Once again, you should have a Repeat of 1 on both the Horizontal (U) and Vertical (V) axis.

Now, look at the bottom of the Texture tab, and copy the "Repeats Per Meter" number from that field. Paste it into the "Repeats Per Meter" field of the other prims, and click the "Apply" button next to the field.

All your textures will be the same size. You'll still need to adjust the Offset, which should really be done while working with a single Face, but you won't have to do any math.

That's what "Repeats Per Meter" is for; getting the texture to be the same size across multiple prims.

Delete the cube, of course, when you are finished.

The caveat is that this is not a terribly accurate measurement; it only goes to the tenth of a meter. So you might find that the size of the texture doesn't fit perfectly on a face that has values in the hundredths or thousandths of a meter.

If that happens, and the texture is seamless, it's not a big problem. All the Repeats that you set will match, even if they don't match the original Cube (since the Repeats there haven't been truncated to the nearest tenth.)

If the size is critical, however, you might want to build so the largest dimension is an even meter, or .5 or .25, to fit in the tolerance, and ensure the Repeats will fit exactly. Then resize appropriately when the texturing is done (with Stretch Textures disabled, of course.)

On the other hand, if what you are trying to do is put a non-square texture on a non-square prim so that the proportions are right, there's a different trick for that. So let me know, if that's the case.
_____________________
Robin (Sojourner) Wood
www.robinwood.com

"Second Life ... is an Internet-based virtual world ... and a libertarian anarchy..." Wikipedia
XiangMei Xingjian
Registered User
Join date: 16 Sep 2005
Posts: 10
12-21-2005 19:36
Thanks a ton! You understood perfectly. I was trying to add a stone wall texture to several odd shaped wall pieces to form several complete stone walls. This looks like it will be a great help. I'm gonna jump on & try it out now...

Thanks again!
XiangMei Xingjian
Registered User
Join date: 16 Sep 2005
Posts: 10
12-23-2005 17:50
Those tips worked great, but they did lead me to a new problem... In instances where I needed to rotate the texture 90 degreees because the prim was rotated 90 degrees, the texture doesn't maintain the aspect ratio again. Any ideas as to why or what to do to fix that?

Thanks again in advance.
Robin Sojourner
Registered User
Join date: 16 Sep 2004
Posts: 1,080
12-24-2005 00:19
Hi! It does it because it's still counting Repeats per Face, really. It just sets them to the size for Repeats per Meter.

So, for instance, it might determine that at .4 Repeats per Meter, on the front and back of this particular prim, that comes to 3.2 Repeats on the Horizontal (U) axis, and 0.7 Repeats on the Vertical (V) axis.

When you rotate the texture, it's still repeating 3.2U and 0.7V, but now it looks all stretched out of shape.

All you need to do is swap the values in the U and V repeats.

You can do this most easily by clicking the Selcet Texture radio button on the top, and shift-clicking on faces that are the same size. When you do, the Repeats will no longer be dimmed (because it's the same for all selected faces.) If it's still dimmed, then your faces aren't the same. Select fewer of them, until those numbers aren't dimmed.

Then just swap the numbers. In our example, you'd type 0.7 into the Horizontal (U) Repeats box, and 3.2 into the Vertical (V) text box and your rotated texture will look perfect. Repeat for all the other matching faces that have a rotated texture, and you're back in business.

You may also find out, when you do this, that some of your textures need to be rotated -90°, instead of 90°. In other words, some of the faces may look like the texture is upside down. If so, just change the sign on the rotation, and it should be fine.

This is assuming that you are rotating the textures 90°, of course. If you are rotating them in smaller (or larger) increments, then the problem is the same, but the solution, I'm afraid, is to "eyeball" it; and it's not going to be possible to get it perfect, since it's still repeating per face, so it will always be skewed on a rectangular prim.

Place it next to a "good" stretch of texture, and do your best.

Even disabling "Stretch Textures" and making your prim a cube won't work, since the texture will be distorted anyway when you change the size. It's just the nature of textures, and the only work-around (as always) is to put the opposite skew on the texture before you upload it.

Hope this helps!
_____________________
Robin (Sojourner) Wood
www.robinwood.com

"Second Life ... is an Internet-based virtual world ... and a libertarian anarchy..." Wikipedia
XiangMei Xingjian
Registered User
Join date: 16 Sep 2005
Posts: 10
12-25-2005 21:13
Thanks again! That works great! Now I'll have the stone walls up on my first build!
Robin Sojourner
Registered User
Join date: 16 Sep 2004
Posts: 1,080
12-26-2005 14:03
That's great! So glad I was able to help.
_____________________
Robin (Sojourner) Wood
www.robinwood.com

"Second Life ... is an Internet-based virtual world ... and a libertarian anarchy..." Wikipedia