Join GitHub today
Add support for compressed textures. #1522
Textures compressed using DXT1 or DXT5 take up less memory and are supported in hardware across almost all (any knwon exceptions?) graphics hardware. With the support of the GL_ARB_texture_compression standard graphics drivers are able to take an uncompressed texture and compress it in (near) realtime.
This patch adds support to for this realtime texture compression hopefully reducing the games video memory footprint and drastically reducing the bandwidth required for texturing during rendering.
In no particular order;
NB: I really am stretching to find all of these I don't think that they're as bad as I'm making them sound.
I've noticed no major rendering issues aside from the obvious decrease in the quality of textures across (laptop) ATi/AMD and (desktop) nVidia GPUs on Windows 7 64bit machines. These are however the only machines I have to test with currently.
Performance is hard to measure as is the actual decrease in memory consumption due to none standard GPU memory querying methods. Again unfortunately both of my platforms have more than enough memory for anything that Pioneer currently throws at them.
I honestly hadn't checked that, we're not using texturing at all? What about the use terrain textures toggle?
All good points otherwise will make the changes now I'm back from food shopping :)
Okay, this seems to work fine (latest gdebugger doesn't show compressed texture sizes but the saving should be sizable).
You still have wrong line endings src/LangStrings.inc.h, fix that and then this should be OK for merge.
Here's an example of noticeable compression artifacts (gradients compress especially badly):
gl or glew functions in gameMenuView should be avoided, same deal as with #1385.
I think the nVidia compressor is based on libSquish, in fact they've contributed code back too it, I know that the SPURS based PS3 library is a cut down version of libSquish as well. Since it's open source I imagine they're all based on it or something similar... which means there's only a limited number of options to choose from (that are easy to implement on GPU/SPU) and some of the best quality ones are already blindingly quick so I doubt the hinting does very much, if anything.
Nevermind all that stuff I assume you already know anyway :D (I mention it more for others reference)
I've now implemented your suggestions, this mean storing another parameter in both the TextureDescriptor and TextureBuilder classes but appears to be the correct way of doing it.
I decided to remove entirely the conditional adding of the texture compression toggle and just always display it, just like the shader toggle is always present even on machines with only FFP support.
There are probably a few other things that can be done, if you are concerned, such as sending normals as signed bytes/shorts instead of floats or packing 8 bit values into floats etc. It's something I had as a to do after the new terrain system is completed (on the other hand also queued are things like introducing new vertex attributes, for things like fractal city lights visible from space, so overall video memory use won't go down :) .. though we might have an option to disable features ).
Reasoning/links to papers are handy - especially in areas like graphics programming which is mostly only of use to game development, as Pioneer people tend to be from wildly different fields..including completely unrelated to IT like science/engineering, let alone graphics programming (you're the only professional game dev to work on Pioneer so far).
Even though Pioneer devs tend to have background/problem solving skills to do things like create an entirely new compression algorithm if needed, they tend to be often working from first principles. One of the main goals of the review system is to reduce the bus factor:)
Luomo isn't a game developer? Thought that he was/is.
Ok well the reasons are pretty simple:
Longer explanation here: Texture Compression
Since we're only supporting OpenGL it only makes sense to use the most common DXT1 and DXT5 formats which so far I'm just having the openGL driver build from RGB and RGBA respectively.
DXT1 does actually support RGBA but it's only 1 bit alpha so we'll be using DXT5 instead.
DXT1 textures should compress down to 1/8th of their original size and DXT5 to 1/4th with varying levels of minor visual artefacts.
There are other things that can be done, but they're dwarfed in my experience by textures. Now, we have a slightly crazy terrain system that produces huge amount of geometry, which is unusual, but even so my gut feeling is that textures will probably still dominate.