Jump to content
  • Advertisement
Sign in to follow this  
Sir Sapo

Loading Textures Quickly

This topic is 4786 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

Hey everyone, In my project, I have to load up about 100 textures(128x128) into memory at the beginning of each level, and this process is taking upwards of 1 minute to load. My question is, does anyone know of anyway to speed this process up, or should I focus my effort on something else? Thanks

Share this post


Link to post
Share on other sites
Advertisement
One way is to store all the files in some kind of larger archive, load that into memory and do all the decoding/conversion using memory mapped IO rather than Disk IO. Also, the next best thing would be to not use an encoded or compressed format. The fastest being just raw RGBA bytes in a file - the idea being you just load the file: disk->RAM->OpenGL with little or no processing. I wouldn't advise this method if you dont wont to have to distribute your game on an eight DVD box set [wink]

Share this post


Link to post
Share on other sites
Quote:
Original post by silvermace
Also, the next best thing would be to not use an encoded or compressed format.


I'm sure that's not true. The processor can churn it's way through data much faster than you can get it off the hard drive, so wouldn't it be faster to have a small file and take a little time to decompress it? The processor is not the bottleneck here, it's the hard drive.

Share this post


Link to post
Share on other sites
Thanks for the replies,

The textures are saved as 24bit .BMPs, so no compression there (unless I'm mistaken).

Also, I was wondering, would it be beneficial for me to store my textures as .PNGs? I assume it is easier to read 50kb from memory rather than 3MB, but does it really take that much power/time to decompress them?

Share this post


Link to post
Share on other sites
I've managed to load reasonably sized png's (bigger than 128x128 anyway) over about 10-15 frames at 70fps, while the game was running. And I was drawing it as it loaded using interlacing too. I never got round to trying it with much else going on though. Loading png's can be a bit of a pain though, libpng could be more friendly.

Share this post


Link to post
Share on other sites
Store your textures with DXTC if at all possible. That way, you stream less data, and your CPU never has to compress or decompress anything. Also, it's almost certainly a bad idea to have 100 128x128 textures; you'll do a lot of texture state churning, reducing performance. Better: one 128x12800 texture (or similar).

Share this post


Link to post
Share on other sites
Quote:
Original post by Sir Sapo
Hey everyone,

In my project, I have to load up about 100 textures(128x128) into memory at the beginning of each level, and this process is taking upwards of 1 minute to load. My question is, does anyone know of anyway to speed this process up, or should I focus my effort on something else?

Thanks


your texture loading routine is horribly inefficent (unless this is for a pocket calculator)
compression etc aint the proper solution.
are u doing something crazy like loading the images one byte at a time?

Share this post


Link to post
Share on other sites

Sir Sapo,

all in all, i would go by Sneftel's way, because DXTC decompression can be done on the hardware directly with nearly no (on todays gfxboards!) performance penalty; using DXTC compression has only some performance breaks when creating/saving the texture to disk (e.g. withing your graphic/paint application), because compressing an image down to DXTC will take some time (depending on your machine speed).

Apart from that, i see no other proper solution for decreasing the loading time significantly, because: loading 3MB from disk, means loading 3MB from the disk. Storing all the stuff in an archive (how games like doom/quake doing it) will not bring you that boost, you are expecting.

Share this post


Link to post
Share on other sites
Does that include sending the textures to the video card or just loading into system memory? If the former, read this pdf to get optimal texture transfer rates. Even if you just mean loading into system memory, it's still a good read.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

I agree with everybody who suggests DXT texture formats. For example, 3MB RGB texture file can be reduced to around 700kb in size which is definetely faster to load. DX comes with handy commands to load those files.

Usually maximum texture size is around 2048x2048, and when packing things in one texture, it isn't possible to make repeating textures.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!