PDA

View Full Version : decrease 'texture-quality(=size?)' in OGL?



B_old
01-22-2003, 09:22 AM
Hello.
A lot of games offer you to decrease the texture quality to increase the performance and I wonder how this usually is done.

I have a theory that you for example could skip every second pixel when loading a texture. This would give you a decreased texture I assume.

Any suggestions for a more 'profesional' approach?

Thanks!


[This message has been edited by B_old (edited 01-22-2003).]

Bob
01-22-2003, 10:03 AM
The general ideas is to make the image smaller.

You can make it smaller in a few ways, picking every second pixel being one. It's easy, but totally ignores any aliasing effects. You can choose the average of a 2x2 square, making it a little bit more complex in code, but still not that difficult, and takes care of aliasing a little. Or if you have good knowledge in multidimensional signal processing, you can make a lowpass filter with cutoff at 50% (assuming you want half the imagesize). The more complex you make it, the less aliasing effects you get, and the better quality you get.

Downsampling, or decimation, is not an easy topic.

Bob
01-22-2003, 10:08 AM
By the way, you can try change the minification filter aswell. For example, if you use trilinear filtering (GL_LINEAR_MIPMAP_LINEAR), you can try GL_NEAREST_MIPMAP_LINEAR instead. Does not interpolate between mipmap levels, but picks the neares mipmap and performs a bilinear filtering.

HamsterofDeath
01-22-2003, 10:32 AM
making images smaller gives a 5% performance-boost but makes the texture 10 times more ugly...

B_old
01-22-2003, 12:05 PM
Hello.
Bob, thanks for the reply! It is good to know about the idea behind this. If you tell me that it could be hard to do I gladly believe you. I propably should focus on something else first. But are you using any of these methods, where did you learn about them if so?
Yeah, I know about mipmapping and I already provide an option to change it. So the next step is to make the texture smaller.

Hamster, I agree that making the texture smaller is not nice to look at, but I think I remember that it made the difference between smooth and jerky gameplay with the Q3-engine (which I fancy) on some computers.

Thanks for your replys!

Bob
01-22-2003, 02:16 PM
If you tell me that it could be hard to do I gladly believe you. I propably should focus on something else first.

Some thing can be difficult, but that average of a 2x2 square method is actually not that hard, and the result is OK when scaling the image by 1/2, which is what you want I assume.


But are you using any of these methods, where did you learn about them if so?

I'm currently implementing the last method I mentioned; creating filter kernels. I learned it at school, I'm studying signal processing at the moment. I do it mainly to try it in practice rather than just knowing the theory.

01-22-2003, 03:01 PM
haven't you people heard of tools like GIMP, PHOTOSHOP, or PAINT SHOP PRO? Are you people actually writing functions to process and downsample your textures?!
Why wouldn't you just use a paint tool? they already have features like this, I would think.

Bob
01-22-2003, 03:05 PM
You only need one picture which you can scale as you want.

M/\dm/\n
01-23-2003, 01:12 AM
My point is, if you have slow PC, then you don't have "bonus" power to do all downsampling tasks & so on & you still have to load huge BMP/JPG/TIF etc and then work on it (I remember "Blade of Darkness" runing on GF2GTS PII350@434, only adding 256MB RAM over my 128MB helped a bit). Even if you are doing this thing at "loading..." screen it'll take quite some time. When you use Photoshop or smthn, then you'll get professional, nicelooking images in few secs, only problem HDD, CD or FDD space.
So you can choose:

=>LOADING<=

=>STILL LOADING<=

=>JUST A FEW MORE SEC<=

=>JUST A FEW MORE SEC, UPS... HOURS<=

=>I HOPE YOU HAVN'T FELL ASLEEP<=

=>WAKE UP I'M DONE<=

=>YOU'VE BEEN KILLED PLEASE RELOAD<=

or waste a litle HDD space.

Bob
01-23-2003, 04:04 AM
Honestly, if your computer is so slow you fall asleep because image scaling requires too much power, you either shouldn't play the game at all, or the programmer should really consider making the scaling algorithm better. And sometimes it's not just about wasting a little more space. That little extra space may require you to, for example, split the download into two parts if your webserver doesn't allow too large files, or you may have to distribute the game on two CDs instead of one.

But I get your point though.

B_old
01-23-2003, 06:08 AM
Hello.
But Q3 has one texture on disc and you can load it in virtually any size, so they are making downsampling I guess, don't you think so?
Actually I think that lots of games let you adjust the texture quality a bit.

rgpc
01-23-2003, 07:46 PM
Originally posted by M/\dm/\n:
My point is,
<snip>



Doesn't make your engine very flexible does it? Q3 doesn't have 47 different detail levels for it's textures (can't say I know of any games that do). Sampling is not that expensive if you take the time to write it properly (it can't be or UT2003 would take a week to load a level).



=>YOU'VE BEEN KILLED PLEASE RELOAD<=


Reload eh? Have you played MOHAA:Spearhead? How long does it take to "Reload" a level?

rgpc
01-23-2003, 07:48 PM
Originally posted by HamsterofDeath:
making images smaller gives a 5% performance-boost

Unless of course you don't reduce your textures and you start swapping them out to disk. That'd be great...

B_old
01-24-2003, 05:42 AM
Originally posted by rgpc:
Q3 doesn't have 47 different detail levels for it's textures[...]

How did you come to 47? I never computed the exact number but there is a command which I forgot which lets you adjust the texture-quality in many steps (and far more than provided in ne options-menu).

Jan
01-24-2003, 06:06 AM
Hey guys, i have a texture-loader, which loads BMPs, TGAs, JPEGs, bla bla bla, and it downsamples ALL types of images. I used bilinear filtering, but at the moment i use nearest, because it is better for images, that use masking.
And guess how long it took me to program all this? Only a few hours.
Now i tell you the secret: It is called DevIL! (http://openil.sourceforge.net/).

And here is an example of how one can do the downsampling with it:




if (iQuality > 0)
{
//if the quality should be reduced, than we divide the image´s size by 2 for every quality-reduction
int div = POW (2, iQuality);

iluImageParameter (ILU_FILTER, ILU_NEAREST/*BILINEAR*/);

iluScale (Info.Width / div, Info.Height / div, Info.Depth);
}


Have a good day.
Jan.