Looking for an elegant solution for texture quality/resolution setting (solved)

Started by
2 comments, last by static_roller 8 years, 5 months ago

In the alpha of my driving game I'm currently offering two texture resolution settings: (very) low, which loads textures as 64x64 (excluding any GUI textures) and normal which load them as is (resolutions varying anything from ~8x8 to 2048x2048).

I did some vehicle interior texturing this weekend and noticed then that this new texturing looks absolutely horrid on my laptop w/ low settings.

An elegant solution in my mind would be to give D3DX11_IMAGE_LOAD_INFO a flag to tell to NOT upscale any textures, which the documentation tells it will do if I were to define width and height bigger than the texture actually is. But I havent found such a flag. This is why currently I give only 0 or 64 for the width and height for the load info.

I do have some less elegant ideas which I wouldn't prefer (otherwise I guess I wouldn't have this problem this day).

I've tried searching the subject and saw some mipmap level related solutions, but seemed kind of a hassle and the solutions I saw weren't DX11 specific, and not sort of complete enough for me to understand. To be specific, I was left with an "understanding" that I would need to add new sampler(s) to the HLSL or something weird & messy like that, also the actual loading seemed like a mess too compared to what I'm doing now..

Such mess is lacking the elegancy I'm looking for here, but if it's the only way to go then sure..

Advertisement

The simplest option is to hook up your texture quality setting to the "FirstMipLevel" parameter.

As long as you textures are saved with mip levels (i.e. they are in .dds files) then that will work well. Dropping one mip level will divide the size of the texture by 4, and dropping two mip levels will make it 16 times smaller. You probably won't need to drop more than that in order to support a wide range of hardware, because dropping two mip levels will take 4GB worth of textures and cut them down to be 256MB.

Also note that most of your textures should probably be stored in BC1 or BC3 format. That will make them 4-8 times smaller than uncompressed textures, and the visual quality will be almost as good.

You could also read the dimensions of the texture and scale that based on texture quality when loading?


D3DX11_IMAGE_INFO srcinfo;
hr = D3DX11GetImageInfoFromFile(filename, NULL, &srcinfo, NULL);

.:vinterberg:.

Thanks for the suggestions, both very simple & straightforward!

But, I tried setting FirstMipLevel to 2 (and 3), but didn't notice any difference in appearance or video memory usage.. Does it work only for DDS?

I stopped using DDS files at some point because of their horrible file size (they were uncompressed though I believe) and the game has lots of textures..

D3DX11GetImageInfoFromFile seems to work fairly nice however, operation takes only 1-3ms so I think I'll go with that for now.

This topic is closed to new replies.

Advertisement