What's better: *.jpg or *.tga?

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
V1979
Posts: 58
Joined: Tue Dec 23, 2014 7:00 am

What's better: *.jpg or *.tga?

Post by V1979 »

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?
m4xpower
Posts: 32
Joined: Wed May 20, 2015 8:40 pm

Re: What's better: *.jpg or *.tga?

Post by m4xpower »

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.
User avatar
Eraser
Posts: 19176
Joined: Fri Dec 01, 2000 8:00 am

Re: What's better: *.jpg or *.tga?

Post by Eraser »

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.
AndehX
Posts: 137
Joined: Fri Apr 10, 2015 10:48 pm

Re: What's better: *.jpg or *.tga?

Post by AndehX »

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
AEon
Posts: 1816
Joined: Sun Apr 20, 2003 7:00 am

Re: What's better: *.jpg or *.tga?

Post by AEon »

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.
m4xpower
Posts: 32
Joined: Wed May 20, 2015 8:40 pm

Re: What's better: *.jpg or *.tga?

Post by m4xpower »

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.
AndehX
Posts: 137
Joined: Fri Apr 10, 2015 10:48 pm

Re: What's better: *.jpg or *.tga?

Post by AndehX »

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.
m4xpower
Posts: 32
Joined: Wed May 20, 2015 8:40 pm

Re: What's better: *.jpg or *.tga?

Post by m4xpower »

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: Select all

#!/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
Fruity
Posts: 71
Joined: Wed Jun 26, 2019 11:11 pm

Re: What's better: *.jpg or *.tga?

Post by Fruity »

Once, on the Internet, I accidentally found someone doing tests and checking various sizes and compression of graphic files on the quake engine, which were later checked in the game. (Quake 3 I think). He checked the differences between the source file (jpg / tga) and what we see in the game, and I have a question for everyone gathered here.
Maybe someone will have pointers to this tutorial or something like that, I was looking for, but the addresses are disappearing and it's hard to find anything now, because as you know, these are older games. I have some of these types of sites, but these are for general information only. Recently, I create textures myself and would like to know how to (finally) export them.
User avatar
Eraser
Posts: 19176
Joined: Fri Dec 01, 2000 8:00 am

Re: What's better: *.jpg or *.tga?

Post by Eraser »

To get back to the thing I said 5 years ago, the main thing to consider here is that Quake 3 is (by now) a 20 year old game which deals with amounts of texture data that are just a drop in the ocean of available RAM. Putting a huge amount of effort in reducing texture data really gains you nothing.

As for download size, it's not 1999 anymore either. Most if not all people who still dabble around in Quake 3 / Quake Live will have broadband connections now, so downloading a map that's 20mb in size is really not an issue.
LDAsh
Posts: 28
Joined: Sat Dec 17, 2016 1:25 pm

Re: What's better: *.jpg or *.tga?

Post by LDAsh »

As far as I know, using JPG was 100% all about download and filesize. It has no bearing on in-game performance because the engine will treat it as any other data in the texture buffer. PK3 compression is more or less going to give you the same benefits as compressing your TGAs to JPGs. Not directly comparable, but pretty damn good compared to previous PAK files.

What it does really affect is loading times. TGAs will load much faster than JPGs because they are structurally much closer to what your GPU is looking for. All it basically needs to do is spew up some mipmaps and the rest is lightning-fast. JPGs need some "refactoring" done first, and then still need mipmaps.
Fruity
Posts: 71
Joined: Wed Jun 26, 2019 11:11 pm

Re: What's better: *.jpg or *.tga?

Post by Fruity »

I can say right away that I don't pay attention to large files (.pk3), slow internet and sluggish PC (.. these things are practically not important nowadays).
I bring this up because I am trying to make an experimental map, rather it will be exploring, not necessarily the default quake3. I care about the best graphic quality (..yes know, it's an old game :-D ...) and some textures will be stretched over the entire brushes (FIT option), because that's the idea. After taking a photo of the sample texture (3000-3000px, 5MB) I reduced it to 1024x1024, 1.5MB which looked fine. I compressed JPG (80% = 450KB), which also looked good in the editor (practically unchanged). I do not know what it will look like in the game, and as you know, the detail (quality / sharpness) in the editor differs slightly from that typically in the game (at least in my case).
[I guess I'll do a quick general test, because if there is no visual difference, but there is a size difference, I can compress JPG]
I read somewhere that TGA files look better in-game so is it possible that there will be a difference between TGA and JPG in-game on the map?
There is also the issue of (FPS), but it probably doesn't matter in this game with today's equipment.
User avatar
Hipshot
Posts: 1547
Joined: Sun Jan 20, 2002 8:00 am

Re: What's better: *.jpg or *.tga?

Post by Hipshot »

No one cares today, just use tga for the quality and that it's lossless, even in like 200?, uh 6? perhaps, this didn't matter...
Q3Map2 2516 -> http://www.zfight.com/misc/files/q3/q3map_2.5.16_win32_x86.zip
Q3Map2 FS_20g -> http://www.zfight.com/misc/files/q3/q3map2_fs_20g.rar
GtkRadiant 140 -> http://www.zfight.com/misc/files/q3/GtkRadiantSetup-1.4.0-Q3RTCWET.exe
Post Reply