Jump to content
  • Advertisement
Sign in to follow this  
Napivo

Having 2000 sprites

This topic is 2481 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites


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

Type-o. My bad.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!