Page 1 of 1

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

Posted: Fri May 22, 2015 7:42 am
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?

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

Posted: Fri May 22, 2015 8:03 am
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.

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

Posted: Fri May 22, 2015 9:14 am
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.

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

Posted: Fri May 22, 2015 11:23 am
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

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

Posted: Sat May 23, 2015 4:23 am
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.

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

Posted: Sat May 23, 2015 1:10 pm
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.

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

Posted: Sat May 23, 2015 1:13 pm
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.

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

Posted: Sat May 23, 2015 1:26 pm
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

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

Posted: Tue Oct 06, 2020 3:21 am
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.

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

Posted: Tue Oct 06, 2020 6:37 am
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.

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

Posted: Tue Oct 06, 2020 7:51 am
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.

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

Posted: Wed Oct 07, 2020 1:56 am
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.

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

Posted: Tue Oct 20, 2020 5:15 am
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...