Texture Usage

From Second Life Wiki
Jump to navigation Jump to search
KBcaution.png Important: This article has not been updated since 2013 and could use improvements. The general idea remains the same, smaller is better with textures, but specific numbers such as memory usage needs updating.

Tips and Tricks for Texture Optimization

We have all been there, teleporting to a new location, everything grey, the need to stand there for 10 minutes waiting for everything to load. Even then many textures still remain blurry. Some people give up and teleport away, some people leave to make coffee. Land owners can lose traffic over it. Store owners can lose customers over it. So optimizing your textures to ensure that they load quickly, without losing any of the visual impact, is important.

As a general rule the smaller the surface the smaller the texture size you need to use. The smaller the better, as the result would be the textures load a lot faster for everyone.

Very small texture sizes on small surfaces can look absolutely fine and you don't lose any of the visual quality. Try using sizes such as 64x64 128x128 and 256x256, and in certain cases you can go even smaller. If the texture becomes pixelated just try increasing the size slightly, but try to keep the size as small as possible.

As with anything it is a balance you're aiming to achieve, as you need to use small texture sizes on small surfaces, but you don't want to go overboard and end up with a pixelated result. For example if you use a 256 x 256 sized texture on object of a certain size the result can end up looking pixelated. In this case you would need to up the texture size to 512 x 512.

If you have one texture repeated many times around your parcel/region, it costs more resources to have that one texture broken down into various sizes for different sized surfaces. In this case it is better to just have one size of the texture throughout your land.

Reducing the number of textures you are using on your land is also a great way to reduce the load time. If you have 3 or 4 main 512 x 512 textures on your land for the main build, and then use smaller sized textures for the detail on smaller objects, this would also make the texture load extremely efficient.

You should rarely ever use 1024 x 1024 sized textures*. Try to avoid using this size as much as possible.

  • Texture sizes broken down into actual file size.
  • An exception to this rule is when you want to use a 1024 x 1024 size texture in place of multiple smaller textures. This is called a Texture Atlas. This is generally more efficient than loading the textures separately. A single 1024 x 1024 texture can contain 4 512 x 512 textures, a single 512 x 512 can contain 4 256 x 256 textures, and so on.

Keep in mind that your average Second Life user has between 128MB to 256MB of memory on their video card. You can see that it won't take much to fill that up if you toss a bunch of large textures onto your builds. Bottom line is, you want to use the smallest texture possible for the appropriate surface size.

Transparency

Believe it or not, a clear texture also causes a hit on the Viewer. There are a few things you can do to keep this to a minimum, in order of most efficient to least:

Use the built-in "Transparency %" setting

  1. Right-click an object and select Edit.
  2. Optionally, click Select Face if you don't want to select the whole object, then click a face to select it.
  3. In the build tools palette, click Texture tab.
  4. Set Transparency %" to 100.

This doesn't work in older viewers. You can also script this:

Create a new empty script in your inventory, and add this to it: <lsl> default { state_entry() { llSetTexture(TEXTURE_TRANSPARENT, ALL_SIDES); }

} </lsl>

Save it, then add it to the prim you want transparent. You can then remove the script, and your prim will remain invisible. Be warned however, that this still adds a memory hit to your build.

Use the Library transparent texture

  1. Select Me menu > Inventory.
  2. Search your inventory for "default transparent". The texture you're looking for is *Default Transparent Texture.

Create your own transparent texture to use

The free transparent textures available in Second Life are generally 256 x 256 pixels but you can upload one that is 8 x 8 to use instead. Simply create a new texture of 8 x 8 pixels in your graphics application, and save it with nothing else added (as a 32-bit .tga or a .png). You now have a transparent texture that should only use 256 Bytes of memory as opposed to the 256 x 256 transparent texture available free in world that will use 256KB of memory.


If you're interested in seeing just exactly what's going on behind the scenes when you teleport into an area, hit ctl+shift+3 which will open up the texture console and you can watch the textures around you being loaded into your viewer. Hit ctl+shift+3 again to close it.


Back to Good_Building_Practices