I’ve been trying to reduce my prim count at my home in SL, and one of the things I figured I could improve on is the pictures hanging on my wall. I’ve got 4 walls of pictures, and each has 3-5 pictures on it, each one on its own prim. So I could see some good savings there.
But how to reduce that number?
Well, a picture is just a texture on a prim. And a wall is also just a texture on a prim. So why not combine the two? Bake the pictures onto the texture of the wall itself.
However, unless you really are pinching every single prim, I think it is better to spend an extra prim per wall and create a transparent veneer onto which you bake your pictures. Think of it as a single picture frame prim that happens to contain multiple pictures. I will refer to this as a “veneer prim” or “veneer” for the rest of the article as it covers the wall just like a wood veneer. However, as I will shortly explain, it is actually preferable for it to be smaller than the wall itself but that doesn’t alter the fact that it is a veneer of sorts.
So what’s wrong with baking the pictures directly onto the wall? Well, in many cases you may not have access to the texture of the wall itself. There are ways round that, of course, but I won’t discuss or condone any of them. But if you ask the creator of your house nicely for the texture, and explain nicely why you want it, they might send it to you.
But even if you do have the texture, most walls tile their texture multiple times per face. Unless your wall uses a single high resolution texture that is repeated precisely once per face then it’s unlikely that baking it directly onto the wall texture will work.
The other thing we need to bear in mind is that the maximum allowable size of a texture is 1024×1024 pixels, as defined on the Limits page of the Second Life Wiki.
So as the size of your wall or veneer prim increases, so the resolution of your pictures is going to fall and you will lose detail. This is called Pixel Density, and you want to maximise this as much as possible, and you therefore want to make your veneer prim as small as possible, since for a given number of pixels the density is proportional to the area. Don’t worry if you don’t get what I mean, it will probably become clear as we progress.
Finally, considerations of texture repeats and Pixel Density aside, it’s just downright tricky and dangerous to directly change wall textures as you run a real risk of accidentally painting your whole house with your new texture since walls are almost always part of a Link Set.
I did exactly that and it was pretty annoying to suddenly find your entire house covered with copies of your pictures as if it had been gift wrapped! And even worse when you find that ‘Undo’ doesn’t include textures. I had to delete my house and rez from a backup to undo that – making sure I copied the exact position and rotation of the current house so I could apply it to the new one (a useful technique to remember, incidentally).
So I will make no further mention of working directly with the wall textures and will leave that as an “exercise for the reader” should you really want to do that.
Creating the veneer prim
Create a new prim using the build tool, making sure you create a box. Don’t worry about it looking like a block of wood just yet.
We want to size & position this prim so that it just covers the wall, just like a wood veneer. However, due to the Pixel Density issue I mentioned earlier, you want it to be as small as possible. Pictures very rarely go right up to the ceiling, so you can gain some vertical resolution by making this prim shorter than the wall. Likewise pictures very rarely go right down to the floor, especially when furniture is present, so you can reduce the height still further by making the bottom edge higher than the floor. Finally, pictures very rarely go right to the edge of a wall, so you can reduce the width too.
To give you an idea of the dimensions you require for your veneer prim, you may want to get the dimensions of your target wall. Your wall will almost certainly be part of your house, so you will need to edit your house and select ‘Edit Linked Parts’, and then click on your target wall to get the dimensions of that particular prim. Don’t change anything on your wall and definitely don’t click anything called ‘unlink’!
If you followed my advice in my article “Oh no! I deleted half my house! (and other disasters)” and locked your house, then you will need to unlock it long enough to get the dimensions as all the edit boxes for the size, position and rotation are greyed out and blank when an object is locked. Be sure to lock it again after!
Please also refer to that article if you are unsure as to what I mean by getting the dimensions.
You might find it more convenient to copy all of the values for size, position and rotation from the wall first, say into a text document, rather than switching back and forth between the wall and the new prim. It’s up to you.
Of course, you don’t have to do any of that; you can just do it by eye if you wish.
Apply each of the rotation values to the new prim so that it is correctly oriented with the target wall, and size it appropriately as discussed above.
You don’t want to set all 3 position values of the new prim to the exact position as the wall, as if you do and then accidentally deselect it, you may lose your new prim inside the wall and be unable to select it again.
Instead you want to position the prim so that it is slightly proud. In other words, it just protrudes from the wall, but only by a small amount; if you make it protrude too much then your picture will appear to hover in mid-air in front of the wall, and if you make it flush then it will have interference patterns with the texture of the wall.
You may also want to adjust the thickness of the new prim to a smaller value than the wall. It’s not really necessary though.
Now go to the texture tab and set the transparency to 100% and also click on the texture swatch and search for ‘transparent’. You should then see the ‘Default Transparent Texture’ in the library which you can select.
Please be very careful that you do all this to your veneer prim and not the wall! In fact you should really lock your house as mentioned earlier to prevent exactly this kind of mishap.
Creating the texture
We now need to take a little trip into Real Life. I know, it’s scary. Don’t want to spend too long there as it can seriously affect your SL! But just look at the prim count on the trees and the resolutions in RL! ;o)
But just before we do, note the dimensions of the veneer prim and calculate the aspect ratio. So, for example, if the prim is 10m wide and 7m high, it has an aspect ratio of 1.42857:1 (which is calculated by dividing the bigger number by the smaller number).
So, to RL now, and you’ll need to fire up your favourite graphics editor, whether that be Photoshop, GIMP, Paint.net, Paint Shop Pro, or whatever. I use GIMP because it’s powerful and free.
Create a new image which is 1024 pixels high and whose width is determined by the aspect ratio you calculated just now. So in the example I gave, the width is 1024 multiplied by 1.42857, which is 1463.
Import each picture you’re going to have on the wall as a separate layer, and then size & move them appropriately until you have everything how you want it. It’s important that each layer has a transparent background so that all the pictures layer up correctly. It’ll be pretty obvious if you’ve got that wrong.
Unless you want your pictures to look like posters, you may wish to add a bevelled frame to each picture. How you do that differs on different graphics programs and is beyond the scope of this tutorial. If you Google for how to add a frame to a picture you are sure to quickly find how to do it. With GIMP I use a Script-Fu called “Add Frame with Bevel” and tick the box which adds a wood texture to the frame and that works for me.
As I have previously mentioned in one of my photography articles, textures in Second Life are either squares or rectangles made of squares, and the largest size you can have is 1024×1024.
We must therefore squash our picture into a 1024×1024 texture which will then get stretched out again correctly in SL.
How you do this depends on the graphics editor you are using. In GIMP this is Image -> ‘Scale Image’, and there is a little icon of a chain between the height and width values which you deselect and which then lets you set the values independently. Set the width to be 1024 pixels and ensure that the height remains at 1024 pixels also.
Your picture will now look squashed. Don’t worry, this is fine! It will get stretched back out correctly in Second Life.
[I should note at this point that I’ve assumed a landscape orientation which is why I said to fix the vertical height and squish the horizontal. You’re of course welcome to do it the other way round if you wish. What we’re trying to do here is get the best Pixel Density for our 1024×1024 pixels and either the height or the width has to get squished to temporarily make it a square for upload. The plane that is getting squished will be the one that suffers a degradation in Pixel Density and I’m unsure whether the human eye is more sensitive to vertical or horizontal, so try it both ways and see if one is better than the other and let me know how you get on!]
Save your picture as a PNG file, making sure you preserve transparency. This is important. Note that you should not save as a JPG (jpeg) file as that format does not support transparency, but PNG does.
Now, we need to get the texture back into SL.
Applying the texture
Fire up your SL Viewer and, when ready, upload the PNG file you just saved. It will cost you L$10 to do this. It’ll probably end up in the Textures folder of your Inventory.
We’re almost there now. We just need to apply the texture to the veneer prim. However, before you do, you may want to take a backup of it first and also note its dimensions (size, position and rotation) in case you mess up and need to restore. Right-click on it and navigate to “Take a Copy” to take a copy of it.
So, select the veneer prim and then drag your texture from inventory onto the correct face. You can also use the texture picker from the prim itself, but you must choose the ‘Select Texture’ setting and then select the face, or it will apply the texture to all faces and you don’t want that.
If you get it wrong then it’s not the end of the world – assuming you took a backup. You *did* take a backup like I told you to, didn’t you?
Before deleting the one you messed up, note its position and rotation (if you didn’t already) then delete it and rezz your backup copy, then apply the position and rotation to it and it will snap to the exact same place. Or, if your Viewer supports it, use “Restore to Last Position” with the backup copy. Either works.
So if all went well, you should now see your pictures on your wall, whether it be directly (if you chose to do that) or with the veneer prim.
It could be that they are rotated or back to front, in which case you will need to play around with the Flip checkboxes and also the Offset values. Make sure that Repeats are set to exactly 1.0 per face otherwise it will be tiled.
Assuming you correctly calculated and applied the aspect ratio then the pictures should look correct and should not appear stretched or squashed.
Are we done now?
Well, we can be. You can finish here if you want. But if you stick around I will show you how to have it so you can change your pictures at the click of a button.
But wait! There’s more!
Alicia Stella has made a script available which, when you click on a prim that contains it, brings up a menu that allows you to select one of up to 22 textures. Depending on settings in the script, the texture can be applied to just one or to all sides of a prim. Obviously we’re interested in applying to just one side.
Create a new script inside the veneer prim (if you’re applying this to the wall directly, you’ll probably want to unlink the wall from the rest of house or else clicking anywhere on your house will activate this script. So that is yet another reason not to work directly with the wall!)
Rename the script to whatever you wish – it doesn’t really matter.
Edit the script and change “integer side = ALL_SIDES” to “integer side = 0” (that’s the number zero not the letter ‘o’)
Repeat the steps from “Creating the texture” for as many as you wish and upload them as textures.
Copy these textures into the same prim as the script (which will be the veneer prim in most cases).
Rename each texture to something short, but unique, as the script will use the first 10 characters of these texture names for the button labels in the pop-up menu. Texture names may not exceed 24 characters.
Now, before you click the wall for the first time and test it, let me make a warning; that side value of 0 is a guess. It could be any number between 0 and 5 for the 6 faces. You’ll probably need a bit of trial and error to find the right one. Somewhat typically on the wall I tried it on, the correct value was 5.
Click the wall and, assuming scripts haven’t been disabled, it will pop up a menu which lets you choose the texture to display. Choose one and the script will change the texture of the face that you specified as the value of ‘side’ in the script.
If you chose the wrong value for the face, then we’ll need to set the texture back to what it was and then edit the script. The easiest way to set the texture back is to have the default texture copied in with the others so that you can just select it from the menu. Select it, and then edit the veneer prim and edit the script inside it and change “integer side = 0” to “integer side = 1”, and retest, and then so on until you find the correct one. Valid values are 0 through to 5 (inclusive).
Bear in mind that the script supports up to 22 textures. It will error if there are more than 22.
That’s it. We’re done. Have fun!
Alicia’s script is available at http://www.aliciastella.com/modules/AMS/article.php?storyid=24
If this becomes a broken link then let me know and I’ll update this article accordingly.