Prim torture

I’ve been trying to make a single-prim analog clock.

There are numerous ways an analog clock can be made in Second Life. So far, the ones I have seen included two different approaches..

The first approach is the obvious one — you create a primitive for each clock hand, and rotate them over the clock face. This looks good, but results in three prims at the very least, and often, quite a bit more for added detail, or at least for the seconds hand.

The second approach layers three minimal thickness boxes upon each other, using the front face of each to display a rotating texture.

While it is obviously impossible to create a single prim clock using the first approach, I’ve been thinking of ways to get more than one texture visible overlaid on the same side of an object. After many unsuccessful experiments with spheres, I have been able to get two textures on one side of a cube, actually:

Pretty trivial once you think of it.

Pretty trivial once you think of it.

While the inside of the hollow cube is counted as a single prim “face”, and is therefore distorted by stretching the texture across four faces that we see, it is distorted in a linear fashion, easy to compensate for by texture repeat settings while still drawing a texture as if it was perfectly flat and not distorted. If the face you see from the side of that hollow cube is transparent, you see the part of the inside face that is furthest away from you, or, to be technical, you see the part of it that has the polygon normals pointing towards the camera and don’t see the part that has the normals pointing away from camera. Squish the cube flat in that direction, and you’ve got an almost flat sheet with two overlaid textures which can be manipulated separately.

There are multiple things this could be used for beside a clock face, for example, for crossfading two arbitrary textures, or assembling fabric patterns from separately tinted textures.

Unfortunately this will only bring the minimal clock primitive count down by one, since you still need another texture for the clock face. I keep hoping there’s some way to do it similar to the technique to get a prim with five separate “faces” side by side, as used commonly for billboards of various ilk, however, it does not seem to be possible without some high wizardry I do not yet know.

Advertisements