What are the consequences of a non-power-of-two texture size?
by Keith G Wood · in Technical Issues · 04/26/2011 (7:42 pm) · 6 replies
There are several places where it is written that textures must have dimensions that are powers of two (e.g. in the file formats tables at the start of the Artists Guide in the documentation).
Now most of mine are, but I've realised I have some that aren't - and yet they seem to be working fine. Now I could go through all the texture images & double check their sizes & modify those that dont comply - but do I really need to do this?
Interestingly, also in the Artists Guide under UV animation it refers to a texture of 768 x 128. Now by my calculations 768 is 2 to the power of about 9.5849... - so there is an example that seems to contravene the power of 2 rule on the same page of the documentation that states the rule!
Am I missing something? Is the power of 2 rule a bit more detailed than the way it is being described? Will my game suddenly explode one day because I happen to have a texture that isn't a power of 2?
Now most of mine are, but I've realised I have some that aren't - and yet they seem to be working fine. Now I could go through all the texture images & double check their sizes & modify those that dont comply - but do I really need to do this?
Interestingly, also in the Artists Guide under UV animation it refers to a texture of 768 x 128. Now by my calculations 768 is 2 to the power of about 9.5849... - so there is an example that seems to contravene the power of 2 rule on the same page of the documentation that states the rule!
Am I missing something? Is the power of 2 rule a bit more detailed than the way it is being described? Will my game suddenly explode one day because I happen to have a texture that isn't a power of 2?
About the author
The perverse mind behind Bad Taste Software: http://www.badtastesoftware.co.uk
Recent Threads
#2
They are useful for fullscreen shader effects, menus and static backgrounds.
04/27/2011 (8:52 am)
non-power-of-two textures are normaly not filered -> no mipmaping.They are useful for fullscreen shader effects, menus and static backgrounds.
#3
04/27/2011 (10:53 am)
Also keep in mind that some hardware (mostly older machines) cannot read/load npot textures which can result in severe artifacts and/or crashing.
#4
I'm going to have to try this, because I found some old posters from the 1930's that I want to use, and they are not powers of 2, nor can you make them that, unless you change the height-width ratio, which would distort them.
I was explaining to someone a while back about powers of 2, and they didn't believe that 1 is a power of 2. ;)
04/27/2011 (7:28 pm)
I can remember when I first started with TGE 8 years ago that textures that weren't powers of 2 would not show up in-game. So, since then, I have always used them.I'm going to have to try this, because I found some old posters from the 1930's that I want to use, and they are not powers of 2, nor can you make them that, unless you change the height-width ratio, which would distort them.
I was explaining to someone a while back about powers of 2, and they didn't believe that 1 is a power of 2. ;)
#5
I will try to change what I can - but as Willbkool mentions, there are some where the aspect ratio makes this difficult.
On the subject of wasting video memory, I have a few questions:
Is there a simple way to determine how much is actually being used?
Is there a reasonable assumption for minimum spec of video memory (i.e. we can resonably expect everyone will have at least so much)?
What happens if the demands exceed the supply? (I assume either things start rendering improperly, or there is a performance hit as reloads are required).
I had been realising that I have several models which actually have the same material, but instantiated separately - so they must be loaded several times (once for each instance). I assume there would be a benefit if I could get all these models to use the same material?
04/27/2011 (8:46 pm)
Hmm, until Michael mentioned the dreaded "crash" word I was feeling good about this. On the other hand, you do say mostly older machines, and given I am using some old machines & not seeing any problems I could assume you mean "very old".I will try to change what I can - but as Willbkool mentions, there are some where the aspect ratio makes this difficult.
On the subject of wasting video memory, I have a few questions:
Is there a simple way to determine how much is actually being used?
Is there a reasonable assumption for minimum spec of video memory (i.e. we can resonably expect everyone will have at least so much)?
What happens if the demands exceed the supply? (I assume either things start rendering improperly, or there is a performance hit as reloads are required).
I had been realising that I have several models which actually have the same material, but instantiated separately - so they must be loaded several times (once for each instance). I assume there would be a benefit if I could get all these models to use the same material?
#6
04/28/2011 (3:29 pm)
That's why I keep all my models that use the same textures in 1 folder, not sure if that helps, but it should.
Torque Owner Alain Labrie
Ware-Wolf Games
example:
44x55 -> 64x64