Peggin' the J

Blitz3D Forums/Blitz3D Programming/Peggin' the J

Adam Novagen(Posted 2011) [#1]
... Yeah that was supposed to be a joke for "JPEG," but w/e.

So, I've had odd experiences with non-PNG textures while making my game, mostly due to my own lack of preemptive knowledge, and I'm wondering: if I want something like a plain, flat background, with no alpha blending or ANY special filtering, just a single quad with a scrolling, colour texture, are there any potential problems that can arise from using a JPEG image? It does of course conform to the normal ^2 rule, with three selectable sizes of 4096x2048, 2048x1024 and 1024x512, and it's a normal RGB image, no paletting, no special compression of any sort, just a JPEG like any other.

I normally use PNG by default, simply because it's lossless, but in this case the lossy compression of JPEG doesn't matter because it's almost invisible on this particular image, and even at Quality:100 it's roughly one thenth the size of its PNG equivalent (even at maximum compression). 550KB is by far preferable over 5.5MB, even in today's world where storage concerns decrease constantly.


Rroff(Posted 2011) [#2]
An alternative would be to use .dds (DXT) paint.net can export this now with many options DXT1 will be about a quarter the size of an uncompressed image and is good for large textures.

JPEG should work fine without any problems but if you are using it for a texture be aware that compression artifacts that may not be apparent when viewed 1:1 on the desktop in an image editing package can be very apparent ingame when the surface is viewed closer up or with some lighting scenarios i.e. if the mesh they are used on is lit in certain ways/colors by ingame lights it can sometimes expose compression artifacts that are otherwise hidden compared to when rendered with the original RGB values in the texture.


As an aside it would seem (tho I've not tested it) paint.net can export to DXT5 with interpolated alpha which is very useful for games tho unfortunatly paint.net doesn't handle alpha channels very well without a plugin so not sure how well it exports those alpha settings.

Last edited 2011


Yasha(Posted 2011) [#3]
There should be no problems.

B3D only really supports two kinds of textures: DDS, and uncompressed bitmap. Everything other than DDS is just expanded to a full bitmap at load time, so the results should be identical.

I have a different observation though - what on Earth needs a 4096p texture? That's normally a sign that you need to break something up into smaller objects (or you're making a very pretty, high-detail game and should be using Leadwerks </snark>).

I've noticed that texture sizes above 2048 can't be relied upon to exist in B3D on all hardware. Some go up to 8192, but not many. On the other hand, this probably won't be a problem for modern cards with enough memory to actually display that sort of thing easily. If this is a high/medium/low detail option for the user to customise to their PC, you might need to do a check that they can actually match the settings if they choose higher ones.

Last edited 2011


Adam Novagen(Posted 2011) [#4]
As an aside it would seem (tho I've not tested it) paint.net can export to DXT5 with interpolated alpha which is very useful for games tho unfortunatly paint.net doesn't handle alpha channels very well without a plugin so not sure how well it exports those alpha settings.

Thanks for that; don't worry though, the GIMP actually has a DDS plugin which I've used a few times. If I end up going DDS I'll be covered.

what on Earth needs a 4096p texture?

Funny you should say that, it's actually a map OF Earth, for a scrolling background. Mostly a cosmetic effect. I just wanted to give it justice on larger screen configurations, and since 1920x1080 and 1920x1200 are fairly common nowadays, I figured I'd cover it with a nice 2048-high texture. That said, I may in fact scale the 4096x2048 to be a 2048² instead; I'll see how that looks today. I had heard of the >2048 issue before, but understood that since it's mostly older graphics cards that have this problem, I needn't be particularly concerned.

So, if all non-DDS imagery is unpacked into 32-bit bitmap form, then I guess that's all I need worry about. Cheers all!


Rroff(Posted 2011) [#5]
Pretty much all recent AMD and nVidia GPUs will support 8192x textures and I've never had problems with 4096x ones on them with Blitz... so depends a bit on your target audience, some integrated GPUs in laptops, etc. and older GPUs sometimes don't even support above 1024x :S Unless I'm specifically targetting older hardware I usually go with "whatever works on an 8800GT".

Last edited 2011


Adam Novagen(Posted 2011) [#6]
Alright, after playing around with textures, formats and compression types, I finally ended up making the 4096x2048 texture into a 2048² texture, saved as a BC3/DXT5-compressed DDS. The visual quality was superiour to the PNG version, and the filesize marginally smaller on disk (though still larger than I'd like). Thanks for all the help!