why textures power of 2?

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
hessiess
Posts: 47
Joined: Wed Mar 12, 2008 8:39 pm

why textures power of 2?

Post by hessiess »

why do textures need to be a power of 2? as far as i am awhere it is no longer a limitation of graphics hardware, and is currently becoming very annoying.

hearers the full size first level of my game(sorry if its abit big)

Image

The level is constructed from 300*150 tiles, the hight is equal to the distance
between the floors, or 1 unit. and the width is half a unit. The tiles are added
together in gimp and exported as a single image. This image can have
potently any aspect ratio and would be imposable to make a power of 2.

the coordinate system works on floors(always an intagur) and a horizontal
location. This is intended to make positioning the sprites easy, as the location
would always be eather an intagur or .5 of one. vertical location is measured
relative to the floor, so i dont haft to worry about aligning sprites vertically.

the problem arises becouse of the power of 2 thing, the image is textured to a
plain. this plain is scaled to match the original aspect ratio, and so that the
distance between the floors is 1 irr unit. vertically this is not a problem. the
problem comes horizontally, where there are major distortions and i cannot
get the image to align with the coordinates accurately enough. with the above
level adjusting the coordinates is not too problematic becouse its small. but i
have some very big levels planed, about 8* the size of this one. I suspect that
as I add hight to the level vertical distortion will become a problem. the fixed
distance between the floors is not ajustasble, due to the way my collision
detection works

how hard would it be to remove the power of 2 thing?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

If your hardware supports NPOT, textures are not rescaled. You can simply check with getSize() and getOriginalSize() on your texture.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Are POT textures still more efficient even if the gfx card supports NPOT textures?
Image Image Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I'm not absolutely sure about this, but it could be. At least calculations are simpler and alignment also has to be handled by the GPU, so chances are good for POT textures to be faster. Question is if it's noticeable.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

My guess is that NPOT textures are just allocated memory to the next largest POT size and are handles just like POT textures but with a large portion unused/transparent. So it would be more like, using a 300x350 is only as efficient as using a 512x512, so you might as well use a 512. That's what I think, but offcourse this kind of thing would vary across implementations.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
hessiess
Posts: 47
Joined: Wed Mar 12, 2008 8:39 pm

Post by hessiess »

hybrid wrote:If your hardware supports NPOT, textures are not rescaled. You can simply check with getSize() and getOriginalSize() on your texture.
the texture dusnt apper to be scaling, which is good, but now i haven't got a clue where the distortion is coming from. its posable i made an error while macing the image, but it cannot be enough to cause such major difarances otherwise it would be visible on the above image.

what can i do about hardware which dusent support npot? could I add extra white space to the image and only use part of it as the texture?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Try to show some screenshots and show the UV map layout. Maybe there are some problems in the mesh.
hessiess
Posts: 47
Joined: Wed Mar 12, 2008 8:39 pm

Post by hessiess »

this thread should explain what im trying to achieve.
http://blenderartists.org/forum/showthread.php?t=120169

its just a ICubeSceneNode, scaled to 0 on the z acsess. x and y scales are relative to the aspect ratio, I assume the cube is just a normal 8 vert cube?

heare is one of the collision arrays, the values are pairs, the player can move freely between the first and second coordinate. element 0 is for floor 0, 1 for floor 1 etc. the coordinates are measured from the left of the image.

Code: Select all

{

	{0.44,5.04, 6.75,8.21, 9.39,10.3, 0,0},

	{1.5,2.41, 4.12,10.3, 0,0,0,0},

	{-1,2.93, 4.12,5.56, 7.28,10.3, 0,0},

	{2.02,10.3,0,0,0,0,0,0}
}
(there is a second array that describes where the player can move between floors, it works in the same way as this one)

if you round these values up or down to the nearest .5 then you get the intended coordinate.

i could use model files for the planes, but it seems a bit OTT as it ill only contain 2 triangles.
wyrmmage
Posts: 204
Joined: Sun Mar 16, 2008 3:12 am
Contact:

Post by wyrmmage »

JP wrote:Are POT textures still more efficient even if the gfx card supports NPOT textures?
I believe so, yes. Apparently the graphics card has to use an entirely different set of routines to perform operations on NPT textures, which are slows than the routines that POT textures are sent through.
-wyrmmage
Post Reply