Page 1 of 1

Multiple texture resolutions.

Posted: Fri Jan 08, 2010 3:26 am
by mkultra333
This would be very useful to me.

At the moment I'm designing textures for my game,and the million dollar question is, of course, what resolution should I make them?

I'd like to go with 1024 by 1024 for most textures so they stay sharp even when the player goes up close. However this will be too much for many cards, so it'd be ideal if there was an option to convert all textures to lower resolutions on the fly. An option to flush out all the textures and reload them at some other resolution, such as half (512 by 512 for me) or a quater (256 by 256).

This would make life so easy. It also helps future-proof the project, I don't have to worry about how graphics cards have all improved a year from now when the game comes out, since I can start with a super high texture resolution confident that the user will find a level that suits his card.

There was some talk of this feature in this thread,, where Assaf Raman details a way to skip loading the top level mipmap of DXT textures. That'd be perfect for me... unfortunately there's no details on how to actually add this code to a project, it might be obvious to Ogre developers but it's opaque to me.

The alternative is maybe to simply include lower resolution textures. That's a pain, it mean a much larger download and 2 or 3 times more work when it comes time to DXT compress everything.

This kind of option on texture resolutions is pretty common on engines, it's be real handy if Ogre could handle it.

Edit: Thought I'd address one concern mentioned in the other thread, that a user might want more control over which textures get loaded which way. While such finer control might be a useful feature to some, I'd be more than happy with just a basic system that allowed me to set the "default" texture resolution and leave it at that.

Re: Multiple texture resolutions.

Posted: Sat Jan 23, 2010 6:54 pm
by bishopnator
I had same problem as you - big textures kill GPU memory very quickly in older cards :) Independently from Assaf Raman I made very similar code for removing top n mipmaps (to desired target resolution) and for other formats I added resizing loaded textures into Ogre::Image before loading them into GPU. I added setScaleFactor method to Ogre::Texture and I set this param before loading textures. I have informations about all my textures in one data file so it is easier to calculate texture scale - for example if original texture is 2048x2048 and user set, that maximum texture size can be 512x512, then scale factor is 2.

I have my ogre's changes at work so if I don't forget I'll post them on monday (only for DX renderer - I don't use OpenGL). But I think, that such support can be integrated in Ogre - now it just handles automatic resizing if textures size exceed HW requirements - maybe it will be enough if user can set this restriction also to lower size (just idea).