How to get texture repeats on the inside of a hollow prim right

Yesterday, I wrote about the issue many of us are facing w.r.t. texturing the inside of a hollow prim, i.e. the fact that the horizontal repeats on the inside of a hollow prim don’t align properly. I raised the issue during Nyx’s Content Creation/Mesh Import User Group meeting that night and an answer was offered by Whirly Fizzle of the Firestorm team and Drongle McMahon. I was pointed to a comment in the discussion of VWR-2397. To cut a long story short, it seems that Second Life’s system determines the horizontal repeats on the inside of a hollow prim by factoring in the outside dimensions of the prim and the hollow percentage, thus leading to a behaviour that is counter-intuitive.

So, if you are going to get the horizontal repeats right, you’ll need to use the mathematical formulae (adapted from the comment on VWR-2397) that follow. I believe that, since OpenSim grids are based on Second Life, the information given here applies to them as well.

1. Horizontal Repeats

Here, we have the following variables:

  • Horizontal Repeats Entered: The number of horizontal repeats that you will enter in the relevant field of the “Texture” tab of your Build tools.
  • Desired Horizontal Repeats: The number of horizontal repeats you want the inside of your hollow prim to have.
  • Hollow: The normalised hollowness of your prim. This means, that 100% becomes 1.0 and, consequently, if the prim is 95% hollow, then your calculation will use 0.95.

So, the formula is:

Horizontal Repeats Entered = Desired Horizontal Repeats/Hollow

Thus, if you have a 95% hollow prim (regardless of its type and/or hollow shape) and you want it to have 1 horizontal repeat, the formula will be:

Horizontal Repeats Entered = 1.0 / 0.95 = 1.0526

I expect that the same applies to the vertical repeats in hollow spheres; I haven’t tested it yet, so any feedback would be most welcome.

2. Horizontal offset

We want the texture  to start and end at the right points. So, we’ll use the following formula:

Horizontal Offset = [  ( Desired Horizontal Repeats / Hollow ) –  Desired Horizontal Repeats ] / 2

In the case of our previous example (1 horizontal repeat), things would be:

Horizontal Offset = [ ( 1.0 / 0.95 ) – 1.0 ] / 2 = 0.0263

Again, I suppose the same applies for the vertical offset in hollow spheres.

I really wish this information was easier to find. The entry for the Build tools on the official Second Life Wiki is beyond outdated; it’s ancient (it covers version 1.23 of the viewer), and the information given there is only basic. Of course, it doesn’t give the information I wrote about in this post.




See also:




One thought on “How to get texture repeats on the inside of a hollow prim right

Comments are closed.