Jump to content
  • Advertisement
Sign in to follow this  
static_roller

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

This topic is 1144 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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..

 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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);

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!