Sign in to follow this  
Napivo

Having 2000 sprites

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:
[list][*]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 :)[/list]Thanks for your advice.

Share this post


Link to post
Share on other sites
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 ([i]or 16MiB when compressed with DXT5,[/i] [i]or 8MiB when compressed with DXT1[/i]).

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
[quote name='Morley' timestamp='1317577345' post='4868320']
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.
[/quote]

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:
[list][*]You only have to load the texture to the video card once[*]Reduce swapping in GPU[/list]
I just need to look out for
[list][*]Older video card that do not support 4096 x 4096[/list]
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this