Having 2000 sprites

Started by
4 comments, last by Morley 12 years, 6 months ago
I'm pretty sure someone answered this one a hundred times but I can't find and relevant data for me.

I have like 2000 sprites in my sprite library and can't fit them all in a single texture2D (4096x4096)

So I decided to create a spritelib class which generates textures and stores the location of my sprites.

That works like a charm but now I read on the Internet that most people frown upon the use texture sizes of 4096x4096 but it looks like these people are talking about 3D worlds with heaps of textures.

Right now I am only creating a 2D world and have 3 of those large textures.

My questions are:
  • When will this become a problem?
  • If I optimize the draw events to minimize the swapping of textures(which I will surely do) does it matter?
  • If using these huge textures is going to be a problem what would be an optimal setting for texture size? Just need to change a const :)
Thanks for your advice.
Advertisement
Different video card generations specify different limits on texture sizes. The requirement to support textures as large as 4096x4096 was introduced in DirectX9.0c, or roughly year 2006 for ATI/nVidia hardware.
If you want to support older hardware than that, you'll have to use smaller textures -- 2048 to support the next-oldest generation of video cards.

Textures of this size become a problem when they begin to fill up your video card's RAM. Each 4096x4096 texture is 64MiB (or 16MiB when compressed with DXT5, or 8MiB when compressed with DXT1).
Assuming this isn't for one "character" I would definately avoid one sheet. Like Hodgman said, it becomes a problem with system RAM. Now, if you split them up into there individual characters, the garbage collector can pickup more when its not in use, thus freeing up space. So definitely try and split it up into multiple pieces.
Morley

Aspiring programmer, modeler and game designer.

Assuming this isn't for one "character" I would definately avoid one sheet. Like Hodgman said, it becomes a problem with system RAM. Now, if you split them up into there individual characters, the garbage collector can pickup more when its not in use, thus freeing up space. So definitely try and split it up into multiple pieces.


This is a video RAM, not system RAM problem - they're very different. No GC for video RAM either.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

I must agree with mhagain and taking Hodgeman's remarks into account.

The advantages of using large Textures are:
  • You only have to load the texture to the video card once
  • Reduce swapping in GPU

I just need to look out for
  • Older video card that do not support 4096 x 4096

What I still need to look into is is the compression thing. DXT5 or DXT1.

Right now If I load like 4 * 64mb to the video card. That would mean I use 256Mb. In itself that is no problem but still have the screen and background to take into account.

Thanks for the info


This is a video RAM, not system RAM problem - they're very different. No GC for video RAM either.
[/quote]

Type-o. My bad.
Morley

Aspiring programmer, modeler and game designer.

This topic is closed to new replies.

Advertisement