Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture Quality Settings

Started by dashrush Jun 28, 2011 at 2:40 AM 2 replies 2.5k views
Original Post
dashrush
dashrush
i'm just putting the polish on my game now, and I would like to add a setting, like in most video games for PC, to set texture quality. What is the best/simplest way of doing it?
Adam_42
Adam_42
The simplest option is to create your original textures at high quality (large size), but when you load them you drop one or more mip levels to cut the size and quality down so they will fit in memory on lower end hardware.

One way to do that is to call D3DXCreateTextureFromFileEx() and add (num_mip_levls_to_drop << 27) to the MipFilter parameter.

You probably also want some game side code to avoid dropping the sizes of certain textures (e.g. 2D UI ones tend to look ugly when they are reduced in size). Also reducing the size of textures which are already small won't save much memory.

You can also allow the user to adjust the texture filtering quality (e.g. adjust D3DSAMP_MAXANISOTROPY).
dashrush
dashrush
Ah, beautiful. Thank you! What would be the best value to include in there, say if I make every non UI texture 1024 x 1024.
Adam_42
Adam_42
The top mip level of a texture is responsible for about 75% of the memory usage, so dropping one or two mip levels should be plenty of texture detail range for any game. For example starting with 2GB of textures and dropping two mip levels from all of them would take you down to 128MB of textures.

Also note that if you're running out of texture memory D3DFMT_DXT1 is 8 times smaller than D3DFMT_X8R8G8B8 and should be less of a quality reduction than dropping a mip level.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.