Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

TGA file size 1 meg excesive?

Cas Logan
Registered User
Join date: 8 Jan 2006
Posts: 8
01-19-2006 06:54
I have juat created my first tshirt following using the templates and instructions provided.

My finished TGA file is just over 1 meg this seems excesive to me and yet I can find nothing in the tutorial that relates to file size or gives any suggestion on how to keep it down.
Is the file in someway converted when I upload and reduced when applied to the AV. If not this would explain lag to me especially when in the busy night club areas. If so would it be better if we all whent naked to the popular areas...lol

Cheers Cas Logan
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
01-19-2006 06:56
I read somewhere that textures are compressed to JPEG2000 when you upload them, so the fact that the source TGA is big doesn't mean that everyone who looks at it will have to download that much data.

1 meg's not that much for a TGA.
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
01-19-2006 06:57
The TARGA file for all clothing items must be 512x512 pixels no more or no less. Do you need to scale it down from something larger?

If you are using Chip Midnight's excellent templates, please note that they are made at 1024x1024 for ease of drawing but must be scaled down to 512x512 prior to upload.
Cas Logan
Registered User
Join date: 8 Jan 2006
Posts: 8
01-19-2006 07:00
Ok I,m a web designer th eprospect of a 1 meg image file nearly gave me a heart attack.... lol
Blaze Columbia
on Fire!
Join date: 21 Oct 2005
Posts: 280
01-19-2006 07:17
You are right, all the 512 square targa files are about 1 meg each.

Ordinal's right. Your client side SL software converts to jpeg2000 before uploading to SL and all textures delieverd in world are jpeg2000.

At least, that's what Chosen Few claims--I assume he's right :)
_____________________


Main Store at Blaze 71,117,22
Cas Logan
Registered User
Join date: 8 Jan 2006
Posts: 8
01-19-2006 07:21
While we're on the subject, If i'm creating a texture without transparancy is it best to save as taga or jpg and if jpg is it worth going through the process of making it web ready ie making the file as small as possible.

thank you very much for your advice so far
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
01-19-2006 07:48
What Introvert, Ordinal, and Blaze have already said is mostly correct, but let me combine the three and offer a little extra info to give you the complete picture.

First, TGA file size is a constant. It always eqauls the pixel memory size. Therefore, a 512x512 TGA will always be 1MB if it has an alpha channel, and 768KB if it doesn't (assuming we're talking about color images, which we have to be for SL). The reason is simple. There are 8 bits (1 byte) in each channel per pixel and 262,144 pixels in a 512x512 image. That number of pixels times 3 channels (RGB) equals exactly 768KB (786,432 bytes), or times 4 (RGBA) equals exactly 1MB (1,048,576 bytes). That's all there is to it.

All that having been said, your texture file sizes in SL are nowhere near that big. Every image in SL is stored in JPEG2000 format (not to be confused with JPEG), which makes the file size pretty tiny. Most 512x512's will come out around 100-150K at an average JPEG2000 quality setting (not sure what setting SL actually uses). SO you needn't worry about files being overly large.

The story doesn't stop there though. The JPEG2000 compression shrinks the file size, yes, but there's no way whatsoever to shrink the amount of pixel memory an image uses, regardless of the file format. If an image is onscreen, it consumes graphics resources, period. Pixels are pixels. So, in terms of live performance after loading the file, the tiny JPEG2000 behaves no differently than the full size TGA. The compression just allows it to take up less storage space and to download faster.

So, the answer to your question of whether or not big texrtures will lag you is yes, but not for the reason you thought. File size has nothing to do with what most people mean when they talk about "lag". Larger files would result in longer waits before textures become visible, but they wouldn't affect live performance (FPS) in any way. For live performance, it's all about the amount of texture memory each image uses, and that is a direct function of the number of pixels in the image, and the number of channels (bit depth).

The bottom line to combat that particular source of lag is to keep textures as small as possible at all times. A good example of where this is typically not done well is in malls. Malls lag worse than just about anywhere else in SL because people do boneheaded things like put a 1024x1024 texture on a 2-inch sign. Multiply that by the thousands of textures in the mall, and it's easy to see why video cards choke. The average mall has gigabytes worth of textures in it, but the average video card can only process a couple hundred megabytes.

So what size should your images be? Well, Introvert was correct that you should always downsize before upload if you're using any of the larger templates that are available, but not for the reason he stated. 512 is the recommended canvas size, but it's not madatory. Technically, anything from 32x32 to 1024x1024 will work. If you use 1024's, you will be a major lag contributor, so don't ever do that, and if you use 32's, your av will look pretty bad, so keep it inbetween. 512x512 is usually the best happy medium, and it happens to be the size of the official Linden templates.

What it really comes down to is using good judgment when choosing cavas sizes. If you're making a complex fancy dress, use 512's, absolutely. If you're making a plain black pair of pants with no detail whatsoever, use 32x32. Basically, go only as big as you have to go to show the amount of detail you need, no bigger.

All textures in SL must be in powers of two, by the way, and all avatar textures must be square. So, 32x32, 64x64, 128x128, 256x256, 512x512, and 1024x1024 are all sizes that will work. Once again though, stay away from 1024, and exercise good judgment.


EDIT: To answer your question about JPEG, don't use it ever. All it does is lower the quality of your image without giving you any actual benefits. All that will happen is you'll turn your pristine source image into a lossy JPEG before it gets automatically converted again to JPEG2000. You'll end up with the whole copy of a copy effect. The degredation will be noticeable (although some people do swear they can't tell the difference). JPEG's good for the web, but it's bad for SL and pretty much all 3D applications. TGA is the industry standard image format for 3D.

Like I always say, use TGA, everday, all the way, TGA!
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
01-19-2006 08:07
From: Chosen Few
...So what size should your images be? Well, Introvert was correct that you should always downsize before upload if you're using any of the larger templates that are available, but not for the reason he stated ...
Sorry, I deleted my post when I realized I answered a question other than the one that was asked. Anyhow, Chosen is the texture guru; heed his words.
Shep Korvin
The Lucky Chair Guy
Join date: 30 Jun 2005
Posts: 305
01-19-2006 08:27
From: Chosen Few
What it really comes down to is using good judgment when choosing cavas sizes. If you're making a complex fancy dress, use 512's, absolutely. If you're making a plain black pair of pants with no detail whatsoever, use 32x32. Basically, go only as big as you have to go to show the amount of detail you need, no bigger.


Aren't all the clothing layers re-baked into a single 512x512 texture, irrespective of source texture sizes?
Cas Logan
Registered User
Join date: 8 Jan 2006
Posts: 8
01-19-2006 08:36
Thankyou chosen I think that has put me firmly in the picture....

Cas Logan
Blaze Columbia
on Fire!
Join date: 21 Oct 2005
Posts: 280
01-19-2006 09:16
From: Chosen Few
The degredation [of saving as jpg] will be noticeable (although some people do swear they can't tell the difference). JPEG's good for the web, but it's bad for SL and pretty much all 3D applications. TGA is the industry standard image format for 3D.

Like I always say, use TGA, everday, all the way, TGA!



Hey, is that a reference to me!? LOL

Chosen, I respectfully join your band of groupies!!!! (although I still think there isn't much noticeable difference!)

But I do wonder...
1. How you know so much about all this? You must be a 3d guru in RL like Chip and Robin.
2. How you type SO fast?
3. How you manage to explain so well!!!
4. and you never have typos!!!

:D
_____________________


Main Store at Blaze 71,117,22
Rez Menoptra
Registered User
Join date: 29 Nov 2005
Posts: 69
01-19-2006 09:35
"All textures in SL must be in powers of two, by the way, and all avatar textures must be square. So, 32x32, 64x64, 128x128, 256x256, 512x512, and 1024x1024 are all sizes that will work."


Umm, really? I just made a bunch of 600x450 jpeg images, and they're some of the fastest loading images I've seen in SL -- and they're not actually mine, as in, I didn't upload them, so they're not in my inventory (which I sometimes think makes things faster). Plus, they're some of the slickest, non-lossy images I've seen, as well.

Granted, they're for a store, so they're not repeated all over the sim or anything, but they're still some of the first things that load everytime I log on.

With regards to them being powers of two -- they are 600 x 450 'cause the sign size they're placed on is 3m x 2.25m -- would that make a difference?

*edit* Didn't notice if this was a discussion just about avatar textures...if so, sorry.
Shep Korvin
The Lucky Chair Guy
Join date: 30 Jun 2005
Posts: 305
01-19-2006 09:44
From: Rez Menoptra
they're not actually mine, as in, I didn't upload them, so they're not in my inventory


SL will have re-scaled them to 1024x512 during the upload process - if you *could* see the inventory copy, you'd notice that they are all stretched and a bit goofy looking... but once they're put onto a prim that's got the right aspect ratio (e.g. 3m x 2.25m) they look fine again.
Rez Menoptra
Registered User
Join date: 29 Nov 2005
Posts: 69
01-19-2006 10:19
Shep, I'd agree with you, but just to test what you said, I uploaded one of them, and SL did seem to resize to 512 x 512. BUT. You can drag the texture (from your inventory, as in, you're just looking at the image itself) to any size you want, so I'm not sure what you're saying. I mean yes, if squished to 512 x 512, it does look wonky, but my real question is what's with the "power of two's" mantra that Chosen Few had stated in their post? I used to believe this too, and there's probably very good graphics card/memory/computer-y logic behind it, so I'm just wondering.

For repeating textures I can imagine why the square formatted texture (i.e. 32 x 32 or 512 x 512, etc) might work better, but for a sign or something which you can know the dimensions of first, is there no benefit to having correctly dimensioned images to the final result?

In truth, my 600 x 450 image is 810000 pixels (or whatever that unit should be), and a 512 x 512 is 786432, so it's just a tiny bit bigger than normal. How much difference (or not) do you think that would make?
Upshaw Underhill
Techno-Hobbit
Join date: 13 Mar 2003
Posts: 293
01-19-2006 15:28
The advantage to using powers of two for your sizes is that the pixels aren't further compressed, compacted and otherwise lost as the image is packed into a jpg2000 image to be uploaded.

If your 600 pixel image is reduced to 512 that's 88 pixels that have just been lost... averaged into other nearby pixels. That's nearly 15 percent of your image lost.

Since jpg2000 is a lossy compression technique it's hard to compare apples to apples exactly but I'd bet even if you made the texture whatever size then used PS's bicubic resizing to reduce to the nearest ^2 you'd be better off.

Best bet however would be to design the texture at 512 x 256 or whatever in the first place.

L8r,
UU
_____________________
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
01-19-2006 16:37
Open GL applications require the use of 2 power textures ....

here i found this, it sorta explains it without getting into a 3inch stack of whitepages

> it'd guess it's because the numerous optimization techniques
> possible by restricting sizes to 2^n. eg. costly divisions and
> multiplies needed to access single texels can be replaced by
> simple/faster bitshifting operations...

Yes, this optimizations were strongly needed with older hardware/apis - fast
access of the data.
OpenGL2 will break with this and support sizes beside of 2^x.

Till Then....
Rez Menoptra
Registered User
Join date: 29 Nov 2005
Posts: 69
01-19-2006 21:47
Hey, thanks for the info -- all good things to know.
Cottonteil Muromachi
Abominable
Join date: 2 Mar 2005
Posts: 1,071
01-20-2006 06:34
This might sound obvious but, don't forget that you don't need to stick with square proportions. If the texture is meant for a signage for example, it can be a longish proportion, like 128 x 1024. Things like simple gradients on a wall also benefit from this. You can settle for a 32 x 512 and simply repeat horizontally.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
01-20-2006 06:47
One thing I do if I have to change the proportions of an image is to rename them include the original X:Y ratio. That way I can always tell what dimensions it should have in SL to be displayed correctly, without having to hunt down the original.

e.g. I have an image called "Foobar" that is 300 x 200 pixels, which I want to turn into a 256 x 256 texture. I export it as "Foobar 1.5x1.tga". If I want to put it on a prim I know that either I'll have to tweak the texture ratios, or make that prim's X size 1.5 times its Y size for whatever face I have the texture on.
Cattrina Careless
Registered User
Join date: 30 Jun 2005
Posts: 102
01-20-2006 22:50
From: Chosen Few
If you use 1024's, you will be a major lag contributor, so don't ever do that


From: Chosen Few
Once again though, stay away from 1024, and exercise good judgment.


Chosen Few's words tend to be gospel to me so after these words of wisdom I went and checked out the textures on our island using the texture console. And <gasp> found we were using a LOT of 1024x1024 textures. I managed to track some of them down via their UUIDs (and wasnt *that* fun!)

Turns out that one of the texture merchants we have been buying quite extensively from sells 1024x1024 images.

My question.....if the merchant doesnt specifiy what size the image is in their store, is there any way we can tell before buying. Or if need be, after buying, because I can always download, mod to better size, and upload again (thoI hate paying an extra L$20 for images I've already paid good money for).

Catt

Oh and I hope this isnt considered a thread highjack <grins> was only way I knew to quote Chosen - lol
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
01-21-2006 02:38
I believe if you open the texture in world it will show you the size information so you can choose. I'm not in world right now and can't get there for a couple of hours, but that's how I remember it.

Remember as well you can only save to disk and manipulate full perms textures directly.
Cattrina Careless
Registered User
Join date: 30 Jun 2005
Posts: 102
01-21-2006 12:56
From: Eloise Pasteur
I believe if you open the texture in world it will show you the size information so you can choose.


hmmm I did poke about last night but couldnt find it. Anyone online who can tell me how??

thx
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
01-21-2006 13:21
If you double click on it in your inventory it should come up in a window saying ";(X pixels)x(Y pixels)".
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
01-21-2006 14:44
Ah, it's not there actually, just checked!

You need to get a prim, edit>textures tab, then select the texture and it shows you the sizes in there. Bit of a faff but it does work.