Sign in to follow this  
Sandra-24

Is there a limit to how many textures I can have?

Recommended Posts

Other than the available memory on the card? Also what color depth do textures use? I have 35 512x512 textures that would consume 18mb of memory at 16bit, and double that at 32bit, so I'd like to use 16bit textures rather. I didn't see an option to set the color depth when I create the textures. Thanks, -Sandra

Share this post


Link to post
Share on other sites
I would hazzard a guess to say you would load the textures in in the format you create them. So in photoshop you would create them as the bit depth you want and let Direct3D do the rest.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sandra-24
I didn't see an option to set the color depth when I create the textures.

The bit depth depends on the format of the texture, which is a parameter of D3DXCreateTextureFromFileEx(). Like the followings:

R8G8B8 - 8 bits per channel (24 total)
A8R8G8B8 - 8 bits per channel, including alpha (32 total)
R5G6B5 - 5 for red and blue, 6 for green (16 total)
A16B16G16R16 - 16 for each channel, including alpha (64 total)

Share this post


Link to post
Share on other sites
Quote:
Original post by ace_lovegrove
I would hazzard a guess to say you would load the textures in in the format you create them. So in photoshop you would create them as the bit depth you want and let Direct3D do the rest.

Eventually you will want to add a few steps in there, such as packing all your images, sounds, maps, and other files into some sort of massive asset file.

Quote:
Original post by circlesoft
The bit depth depends on the format of the texture, which is a parameter of D3DXCreateTextureFromFileEx(). Like the followings:

R8G8B8 - 8 bits per channel (24 total)
A8R8G8B8 - 8 bits per channel, including alpha (32 total)
R5G6B5 - 5 for red and blue, 6 for green (16 total)
A16B16G16R16 - 16 for each channel, including alpha (64 total)

Except for 565, those would all be *bad* choices for a production game. You probably want to use DXT3 or DXT5 compressed textures if there is an alpha component, DXT1 otherwise. Compressed textures are easier on the graphics card (faster framerates), require less memory (allow more textures) and are faster to transfer to the card (faster loading).

frob.

Share this post


Link to post
Share on other sites
Quote:
The bit depth depends on the format of the texture, which is a parameter of D3DXCreateTextureFromFileEx(). Like the followings:


Yes you're correct, but in managed directx I see no equivelent. Only one Texture constructor takes a format argument, but it doesn't take an image argument and I see no method that would allow me to load in an image after creating it.

So is there no limit to how many textures I can have asside from system resources?

-Sandra

Share this post


Link to post
Share on other sites
Quote:
Original post by Sandra-24
Quote:
The bit depth depends on the format of the texture, which is a parameter of D3DXCreateTextureFromFileEx(). Like the followings:


Yes you're correct, but in managed directx I see no equivelent. Only one Texture constructor takes a format argument, but it doesn't take an image argument and I see no method that would allow me to load in an image after creating it.

So is there no limit to how many textures I can have asside from system resources?

-Sandra


Realistically, you are going to run out of video memory first based on the size of your textures, unless you are doing weird stuff like wanting millions of 1x1 textures or something. All major cards* support DXT compressed textures on the card, meaning your video memory is effectivly doubled, trippled, or whatever the compression rate you are getting is.

frob.

(* except those that don't)

Share this post


Link to post
Share on other sites
First off, for loading you can use a TextureLoader. That should do the trick.

As for the limit, 35 is way below any limit, should one exists. I don't really think there is one, only the memory offered by the card.

Hope this helps :).

Share this post


Link to post
Share on other sites
Be aware that Direct3D provides resource management services, which includes paging data in and out of video memory as needed - if you've got 18 meg's worth of texture data in 35 seperate texture objects, but the card only has 16meg of memory available for your textures, Direct3D can be told to store all the textures in system memory and do the work of copying the texture into video memory as and when you need it (and freeing up the one you least recently used). It's better to be able to fit all your textures into video memory, sure, as you'll avoid any stalls while waiting for textures to finish copying from system->video memory, but you don't need to manage everything yourself.

Share this post


Link to post
Share on other sites
Quote:
Original post by frob
Except for 565

Which looks bad....

Quote:
Original post by frob
those would all be *bad* choices for a production game. You probably want to use DXT3 or DXT5 compressed textures if there is an alpha component, DXT1 otherwise. Compressed textures are easier on the graphics card (faster framerates), require less memory (allow more textures) and are faster to transfer to the card (faster loading)

... and look bad. You can't get anywhere near acceptable quality for animated 2D sprites and fonts, for instance, using the DXT compression. Certainly DXT has its uses, especially for textures that are viewed at a distance in a 3D setting, but I totally disagree that the high-quality formats are bad choices for production games.

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