Quake3World.com Forums
     Level Editing & Modeling
        What's better: *.jpg or *.tga?


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: What's better: *.jpg or *.tga?

Grunt
Grunt
Joined: 22 Dec 2014
Posts: 58
PostPosted: 05-21-2015 11:42 PM           Profile Send private message  E-mail  Edit post Reply with quote


What's better (if there is no alpha channel): *.jpg or *.tga?

1. SIZE - I know that *.jpg size is less. But what's about multiple files zipped in *.pk3 archives?
2. QUALITY - Is there any visible difference how the game engine draws textures of *.jpg or *.tga files?
3. SPEED of reading and rendering (visualization) - What files (*.jpg or *.tga) are rendered faster?




Top
                 

Trainee
Trainee
Joined: 20 May 2015
Posts: 32
PostPosted: 05-22-2015 12:03 AM           Profile Send private message  E-mail  Edit post Reply with quote


V1979 wrote:
What's better (if there is no alpha channel): *.jpg or *.tga?

1. SIZE - I know that *.jpg size is less. But what's about multiple files zipped in *.pk3 archives?
2. QUALITY - Is there any visible difference how the game engine draws textures of *.jpg or *.tga files?
3. SPEED of reading and rendering (visualization) - What files (*.jpg or *.tga) are rendered faster?



1 + 2. Size + Quality:
use imagemagick to convert your TGA to JPG:
convert -quality 97 -filter Lanczos <input.tga> <output.jpg>

another imagemagick command to compress jpg:
mogrify -quality 97 -filter Lanczos <file.jpg>

and try to reduce the general filesize of a jpg by removing EXIF and other clutter (not an imagemagick command; see google for details):
jpegoptim --strip-all

quality setting at 97% is hardly noticable. Even if you zoom / stretch the image by factor 4 or 6 and certainly not ingame.
Always convert your tga skybox to jpg and reduce the quality a bit.

3. Speed:
I would presume the "burden" to renderer and q3-pk3 filesystem is also reduced when the filesize is reduced.

TIP:
use 7zip (zip setting ofc) to create your pk3 archive.




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 42770
PostPosted: 05-22-2015 01:14 AM           Profile   Send private message  E-mail  Edit post Reply with quote


For all practical means, simply stick to JPG for non-alpha channel textures and use TGA for textures that have an alpha channel. Quake 3 is a 15 year old game, there's not much performance to be gained from choosing one format over another.




Top
                 

Commander
Commander
Joined: 10 Apr 2015
Posts: 137
PostPosted: 05-22-2015 03:23 AM           Profile Send private message  E-mail  Edit post Reply with quote


Yeah for none alpha images, stick to JPG, and for convenience, if you have Photoshop, you can save them with quality setting of 12 (max) and theres no difference in quality between that and a TGA




Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 05-22-2015 08:23 PM           Profile Send private message  E-mail  Edit post Reply with quote


I recently noted how well TGA files actually pack in zip files, i.e. pk3 files. So the size issue of TGA is a lot less worse than iz initially might look as compared to JPG. Plus TGA does not use lossy compression. Many of the artists thus prefer to use TGA images for their original textures. And since JPG uses compression I would also imagine that "decompessing" the JPG textures for use on the GPU would tax the CPU somewhat more. But since the engine is so old and our hardware so powerful now, it should be irrelevant in either case.

So as was mentioned, if you do not need transparency, i.e. an alpha channel in your texture, convert them to highest quality JPG... 97% sounds fine.




Top
                 

Trainee
Trainee
Joined: 20 May 2015
Posts: 32
PostPosted: 05-23-2015 05:10 AM           Profile Send private message  E-mail  Edit post Reply with quote


map: Industrial by Hipshot (industrial.pk3)
size: 45.308kb; optimized: 23.971kb; percent: -47%

map: La Petite by cityy (ct3_20b2.pk3)
size: 54.828kb; optimized: 32.513kb; percent: -40.7%

map: The Edge of Forever by Sock (moteof_final2.pk3)
size: 50.455kb; optimized: 34.035kb; percent: -32.5%

map: Rustgard by Hipshot (rustgard.pk3)
size: 33.976kb; optimized: 23.743kb; percent: -30.1%

map: Freestyle Academy by Morbus (AMT-Freestyle6.pk3)
size: 42.209kb; optimized: 30.922kb; percent: -26.7%

map: Goldleaf by Pat Howard (goldleaf.pk3)
size: 10.618kb; optimized: 7.850kb; percent: -26%

map: Aerowalk by the Hubster (hub3aeroq3.pk3)
size: 1.223kb; optimized: 966kb; percent: -21%

map: McSarge's by cityy (ct3tourney3.pk3)
size: 106.567kb; optimized: 85.194kb; percent: -20%

As you can see, I had some "fun" with some current and classic maps.
Using Imagemagick (identify, mogrify, and convert) and jpegoptim the filesize can be heavily reduced.
Especially, when tga files w/o any alpha can actually be stored as jpg.
So maybe keep that in mind for your future mapping fun :)...

Imagemagick:
identify -verbose <filename.tga>
Look (grep) for "Type:" and it'll tell you, if the file has an alpha channel - and ofc only convert those textures w/o alpha channel.




Top
                 

Commander
Commander
Joined: 10 Apr 2015
Posts: 137
PostPosted: 05-23-2015 05:13 AM           Profile Send private message  E-mail  Edit post Reply with quote


Hmm thats a really handy way to reduce the filesize of a map. I still question weather its worth it since it takes seconds to download maps these days, but I guess if its a quick and simple process, then why not.




Top
                 

Trainee
Trainee
Joined: 20 May 2015
Posts: 32
PostPosted: 05-23-2015 05:26 AM           Profile Send private message  E-mail  Edit post Reply with quote


AndehX wrote:
Hmm thats a really handy way to reduce the filesize of a map. I still question weather its worth it since it takes seconds to download maps these days, but I guess if its a quick and simple process, then why not.


The process is pretty simple. I've written a small shell script for that. The script converts all non-alpha TGA in the current folder to JPG, creates a backup of the converted TGAs and optimize the JPG in the local folder as well.
Only thing you need is Imagemagick and jpegoptim.
The consequence of the filesize reduction is ofc that your download will be faster.
The loading times of the map/pk3 however won't change. That's totally depending on the map (BSP) and your machine.

Code:
#!/bin/bash
mkdir TGA_SOURCE
chmod 777 TGA_SOURCE
for TGA in *.tga; do
   ISTGA=$(identify -verbose "${TGA}" | grep "Type:" |grep "Alpha" | wc -l)
   if [ ${ISTGA} -eq 1 ]; then
     echo "IS TGA: ${TGA}"
   else
     echo "NO TGA: ${TGA}"
     convert -quality 100 "${TGA}" "${TGA/.tga/.jpg}"
     mv  "${TGA}" TGA_SOURCE/
   fi
done

for i in *.jpg; do mogrify  -quality 97   -filter   Lanczos $i; done
for i in *.jpg; do jpegoptim  --strip-all $i; done




Top
                 
Quake3World.com | Forum Index | Level Editing & Modeling


Post new topic Reply to topic


cron
Quake3World.com
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group