Jpg and png texture performance
by Keith "The Dip" Wagner · in Torque Game Engine · 03/31/2005 (8:19 pm) · 31 replies
Tried searching, but came up with no results.
Since jpg and png are two different image formats, they are no doubt read in differently. My question is if they are rendered any differently, and which has a better performance for slower machines. So far, png's have been smaller in size for all the textures I have compared, and it would be nice to stick with them. If jpgs have a performance benefit, though, I would rather use them and use a little more hd space.
Since jpg and png are two different image formats, they are no doubt read in differently. My question is if they are rendered any differently, and which has a better performance for slower machines. So far, png's have been smaller in size for all the textures I have compared, and it would be nice to stick with them. If jpgs have a performance benefit, though, I would rather use them and use a little more hd space.
#22
thanks
04/06/2005 (8:43 am)
Joe, can you explain to me how you got dds and DXT to work with torque. Now I know that the TSStatic defines the following properties: S3TC and S3TCTextureName. I understand that i need to set S3TC to true, but I don't really understand how to use the S3TCTextureName. Because for a given dds object, there can be so many textures associated with it. Can you clarify how i can test out using DXT in my game to see if I see a performance improvement.thanks
#23
png2jpg("path/to/your/bitmap.png", [optional quality setting 0-100]);
default quality is 90 so you could just use...
png2jpg("path/to/your/bitmap.png");
And it will split the alpha off of any .png that has it and save it as a .jpg which is good enough if all you want is the alpha channel anyway.
04/07/2005 (11:23 pm)
A splitter is built into TGE. If the .png has an alpha channel it will split it off into a separate .jpg. The new .jpg's will be saved into the same folder as the original .png. To use it type...png2jpg("path/to/your/bitmap.png", [optional quality setting 0-100]);
default quality is 90 so you could just use...
png2jpg("path/to/your/bitmap.png");
And it will split the alpha off of any .png that has it and save it as a .jpg which is good enough if all you want is the alpha channel anyway.
#24
PNG compresses colours horizontally and vertically (.gif does only horizontal, png will always beat GIF compression) so if you have an image with areas of "flat" solid colour then it will compress good - ie cartoon cel, posterised images.
Gradients, not as well. Circular gradient, worst.
Jpeg does areas of an image based on how it will look to the eye, it just fudges it's way through it basically - and it does a BAD job of flat colours, so never use it on images with "flat" colours (like screenshots of windows file explorer). It does a great job on photos of treets and fuzzy stuff.
You can use JPEG all you want, just make sure you keep PNG originals because editing a JPEG never works out nicely, they just degrade with every edit!
04/21/2005 (11:47 pm)
If anyone is still confused about why a PNG has various sizes for certain images just think of how it compresses.PNG compresses colours horizontally and vertically (.gif does only horizontal, png will always beat GIF compression) so if you have an image with areas of "flat" solid colour then it will compress good - ie cartoon cel, posterised images.
Gradients, not as well. Circular gradient, worst.
Jpeg does areas of an image based on how it will look to the eye, it just fudges it's way through it basically - and it does a BAD job of flat colours, so never use it on images with "flat" colours (like screenshots of windows file explorer). It does a great job on photos of treets and fuzzy stuff.
You can use JPEG all you want, just make sure you keep PNG originals because editing a JPEG never works out nicely, they just degrade with every edit!
#25
How expensive is DDS decompression in software? If you don't have hardware support, how much of a penalty would you pay to decompress it with the main CPU?
Official PNG web site: http://www.libpng.org/pub/png/
04/22/2005 (6:37 am)
Re storing images uncompressed, note that while that will save CPU bandwidth, it will cost more in disk bandwidth. The time you save in decompressing will likely be more than made up in the time it takes to copy the file from disk to memory and then into video memory.How expensive is DDS decompression in software? If you don't have hardware support, how much of a penalty would you pay to decompress it with the main CPU?
Official PNG web site: http://www.libpng.org/pub/png/
#26
04/22/2005 (7:30 am)
DDS doesn't work if you don't have hardware support - the driver will just fall back to using an uncompressed copy of the texture. Many games simply let the driver do the compression work, although this is decreasingly popular.
#27
05/03/2007 (9:11 am)
Resurrecting this thread - I did not find a definite answer on texture performance. If I load 6000 textures at Torque startup, which format would give me a faster startup time? JPG, PNG, or something else?
#28
Go with whatever format works best for your artists...
05/03/2007 (10:03 am)
I don't think you're going to see any noticeable performance increase... You might get a very very slight increase in load times by using a non-compressed format like bmp files, but in the end they all end up in memory the exact same way, so you will see NO difference in rendering speed.Go with whatever format works best for your artists...
#29
Yes, I do know Torque converts all textures into a BMP data structure, so I'm wondering if loading BMPs will make this process any faster. I've noticed that the load BMP function is less complex than the PNG and JPG load functions. Any suggestions?
Thanks
05/03/2007 (10:17 am)
I'm really only concerned about the load time. 6000 textures crashes out Torque, and reducing this number will reduce my load times. I'm up to 11 minutes with many textures, and I need this number close to 1 minute. Yes, I do know Torque converts all textures into a BMP data structure, so I'm wondering if loading BMPs will make this process any faster. I've noticed that the load BMP function is less complex than the PNG and JPG load functions. Any suggestions?
Thanks
#30
05/03/2007 (10:35 am)
Well, a better strategy would be to not pre-load 6000 textures....you are basically trying to shave off seconds by picking a different texture format, when your main issue is resource utilization in general.
#31
05/03/2007 (10:40 am)
Wow, yeah 6000 textures is a bit over board, eep...
Torque 3D Owner Miguel Castillo
On the other hand, PNG, as someone else mentioned already, it takes advantage of deflate for compression. So, all the data is there, just crunched together.
I am not an artist, but from my experience with file formatting the rule of thumb to use JPEG only when high quality images are not the important factor. E.g. Sky Boxes. However, when you need higher quality images, use PNG. E.g. Character textures and normal maps. Oh boy, you do not want to JPEG a normal map!!!
Conclusion: Each format has its benefits, you just need to know when to use each.