Using textures in AW

We already did speak about solutions to improve the famerate : we told that size of the objects and textures is important. In january 2011 we had some modeling and texturing classes in AW by Stacee(#319521) : 1." Does size matter?" and 2. "Beginning to think Real-Time'. These classes have been repeatedly published in the AW Forum , in the AW newsletter and also in the Yellow Gazette. Visit also AWSchool 81S 165W , where you have a 3d view of Stacees 3D classes.

For pictures and textures, we can use quite a lot of file types in Activeworlds: .jpg .gif .png. .bmp. In a real-time 3d environment however, there is more than only the texture file type : The capacity of the computers has increased, the patience of its user has decreased : So we will have to optimalize the 3d-environment, so that the real-time visitor has a positive experience about it.

What happens when you enter a world ?

1. Downloading :
The models (the geometry) and texture files are downloaded from the server, where the world owner has installed those objects and textures.
2. Loading of the files :
The files are stored into the internal memory of the computer of the visitor, so that the can be viewed later (=stored as cache).
3. Rendering into a scene :
This is the time that is needed to make all objects in the world visible : this aspect indicates how fluently the objects are loading for the visitor. This may not last too long, and the computer of the visitor should handle those downloads easily.

What do you need to know before you start using textures ?

1. Textures available on het internet :
it's better to resize these textures, because textures on the internet are mostly made for another purpose than for real-time 3d use. Mostly the file size is too large to use in the 3d worlds of Activeworlds , and should be reduced or converted into another pixel size.
2. The powers of 2 :
Number 2 is an easy number for the computer, that's why we advise you to use texture sizes which are a multiple of 2, because the computer needs less time to calculate those numbers. Picture sizes are indicated in "pixels", so we mean : 64x64 128x128 256x256 512x512 pixels. You can also use rectangular pictures : 128x64 512x32 . But if you the height is a multiple number of the width, Activeworlds will consider this as a filmstrip and will make an animation: (32x256pixels) . If you would use 357x563 pixels, the computer needs extra time to put that texture upon the object. So, in Activeworlds, the pixel size is more important than the file size (indicated in kb). With such texture sizes the world will download more easily.

What picture size do you use ?

For this you need to take these things into consideration :
1. The size of the object :
How much time does your computer need to download a texture? It's obvious that you won't put a 512x512-pixels texture upon an object that is only 10cm high. For small objects like flowers, books, lamps : a texture size of less than 128 pixels is sufficient. For large objects like walls.trees and buildings : here you can use more pixels for the textures. For textures with text : here you can use more pixels , so that the text can still be read well. For terrains : 512x512 pixels, surfaces of 5x5m : 256x256 pixels.
2. The importance of the object :
What role does the object and texture play in your world , is it an important item, or is it just only a background player ?
3. The video memory of your computer :
Use small textures if possible, maybe your computer has a good memory card, but also consider the video cards of the visitors. The larger the pixel size , the more video memory is used, if you double the pixel size, then it will take 4 times more of the video memory. The texture will "perhaps" have sharper lines, but it will reduce the power of the video memory.

Small textures means also a quick download. A picture of 1024x1024 pixels will take 3mb of your video memory. Such format is only suitable for a large panel. If you use e.g. transparancy with it, this will be 4mb. Try to use 512x512 as largest picture size. You also need to know that the computer needs to calculate each time that 4mb file when you move around with your avatar, causing lag on your computer .Large numbers of textures that take up more space than available video memory and will cause your computer to constantly have to swap textures in and out of memory.

pixel size video memory (as you see : increases 4 times)
256x256pixels 192 kb (uncompressed)
512x512pixels 768kb
1024x1024pixels 3.145.728 kb = 3mb
+ transparency 4,194,304 kb = 4mb

Texture optimalisation

Here some useful tips for your textures in a real-time 3d environment.
1. The number of textures in the world :

Try to reduce the number of visible textures : the more textures are visible at the same moment, the more video memory will be used. And if you use too many 1024x1024pixel-textures, then the computer will calculate each time those large files in the video memory , and there will be latency in the 3d world. So try to use small textures that fit into your video memory, and your world environment will run smoothly. Try to reduce the number of textures by re-using the same textures on different objects.

2. UV mapping :
Try to use UV-mapping. First you can make the texture seamless (e.g. with Photoshop). A seamless texture means that you can put 2 identical textures besides eachother, so that you don't see a borderline between those 2 textures , and can be used as a pattern. When using a modelling program (e.g. Wings3d) , you can use this seamless texture pattern on your model ( UV-mapping) : then you will use 4 times a 128x128pixels-texture as a pattern. instead of using 1 picture of 256x256pixels, . This means you will use 4 times less video memory as well.
3. Sferical wrap/unwrap :
In some modelling programs you wrap/unwrap an UV-texture for a model (eg. Wings3d) : here you are using several textures of the object upon 1 texture. If some edges don't cover properly the object, you can solve this with the Clone Tool in Photoshop, and you can put the texture into a better format, eg. 256x256 pixels instead of 512x512 , if you want to reduce video memory.

4. File compression and optimalisation :

In some texturing programs, like Photoshop , Fireworks and PaintShopPro you have the possibility to choose for "Image Optimalisation", and choose a lower kb size and pixel size with equal texture quality. In Photoshop you can also choose to "save for web", instead of the usual "save as", this methode will however reduce the number of colours in the picture, but the kb size will be a lot better. In PaintShopPro you can choose "export to jpg optimizer" , and select "value of amount of optimalisation" , where you will see each time a different file size , when choosing another level. Tip: first save as bmp and then compress. If you use text on your texture, don't compress because the text will be less nice.

5. Use how many pixels? :
You can use this rule for the right pixel size : 1cm in Activeworlds equals 1 pixel for your texture , if you can use a smaller size, then use smaller.
1024x1024pixels = 1.048.576 pixels would be for 1 cell in AW or 1.000.000 cm2.
256x256pixels = 65536 pixels would be good for 5x5m surfaces
6. Object shape :
if you want to choose a texture size, you need to consider also the shape of the object upon which you need to put the texture. If the model is rectangular shaped, the aw browser will stretch out the texture on the dimensions of the object, but which will decrease the texture quality. So if you make a texture : try to approach the object size, but also considering the powers of 2 : you can take a width of 320 pixels instead of 256, knowing that 256+64=320. The computer will only do a minimal calculation.

Some examples ....

(Click upon the picture to view the real size of the pictures and then right-click to see how many kb and pixels each picture has).

"Christmas texture" : sferical wrapping texture of 512x512pixels : here you see seperate texture parts on 1 texture, which you can get by grouping the faces in the modelling program.

This "toy horse" of 900x632 pixels is 131kb. This is a rectangular texture, but you can to change the size into 256x256pixels with the same results. Normally the texture should be less beautiful , because some texture details will disappear, but it's better to try it out first and see the result before using it in the 3d world.

This "pumpkin" texture is 600x272 pixels, this is good, the pixel size is a multiple of 2 , however the computer will make a small calculation.



This "stove" texture is 512x512pixels or 65890bytes (65b). The "stove cover" texture is 470x461 pixels or 125540 bytes (125kb). Although the stove (which is a multiple of 2) has a larger pixel size than the cover, it has a lot less kb than the stove cover. You can also see that this stove is made with UVmapping and contains different texture parts of the model. Although it seems that it is modeled, it is only part of a texture.You can see the real 3dmodel in AWschool on location 86S 157W.





Read also :

- AW newsletter (jan. 2002) : http://activeworlds.com/newsletter/0102/010206.html
- AW newsletter (apr. 2011) : http://activeworlds.com/newsletter/0411/041109.html
- Yellow Gazette (aug.2011) : http://www.pbwhite.id.au/yellowg/archives/aug-2011/buildtips.html