Click to See Complete Forum and Search --> : Max Texture size on cards?
Sharsnik
May 10th, 2008, 04:33 AM
Hi, I'm designing a (currently) 2D game. The sprites I use are getting pretty big (96x96 pixels, about 500 frames per). I'm currently storing them as a single texture, which works fine, except that on some cards the sprites get deformed.
It seems like they resize the height of the sprites, and you end up with smushed characters running around. The problem only seems to happen on computers with less than 512mb of graphic memory, so I'm thinking it's a problem with the texture storage. Though, I'm only using about 5mbs of sprites total, so I'm not 100% sure.
Anyone have any insights in to what might be the case? I believe that if I split the sprites into separate textures the problem will solve itself, but, I'd like a better solution.
Syslock
May 10th, 2008, 07:52 PM
The sprites I use are getting pretty big (96x96 pixels, about 500 frames per).
96x96 is not a power of 2. I suggest using 64x64 sprites.
If you want to avoid problems will older cards or cards with less memory, use textures that have sizes of power of 2.
Sharsnik
May 10th, 2008, 08:53 PM
I switched around the size of the sprites, so they're all 2048x2048. That's still a bit big, especially for older cards.. but that's good enough for a place hold 'til I goto 3D models...
Anyone know about how "good" a card you need to support 2048x2048 textures?
Lindley
May 10th, 2008, 09:27 PM
Well, the NVIDIA 7-series cards can do 4096x4096, so I suspect the 6-series would be fine for your needs (at least); dunno about older ones.
On a related note, sometimes when I download an image to a texture it comes out slanted, as if it's cutting off one column of the image and displacing that pixel to the next line. This is on a 7-series Quadro. I *think* I've only seen this happen when the texture size is odd, but I'm not positive.....anyone know why this is?
STLDude
May 10th, 2008, 10:40 PM
To get maximum size textures valid for 3d card;
HRESULT IDirect3DDevice9::GetDeviceCaps( D3DCAPS9 *pCaps);
where then you can query D3DCAPS9::MaxTextureWidth and D3DCAPS9::MaxTextureHeight.
So, you have at least couple options, one is to provide several sizes of the same sprite sheet, like 512x512, 1024x1024, 2048x2048, etc, and then load appropriate one. Those textures could be the same but scale down. People with older cards will get lower quality of textures. Another option is to store sprites as a separate images and compose one texture at run time (in your code). It's more work, but pretty flexible.
P.S. When comes to 2D games, most people do create several version of textures (option one).
Sharsnik
May 11th, 2008, 02:11 AM
P.S. When comes to 2D games, most people do create several version of textures (option one).
Yeah.. in retrospect that would seem to be the best option.. though, since I plan on switch to #d before anything gets "official" I think the 2048x2048 hot-fix will suffice. Thanks for all the tips :3
codeguru.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved.