Sign in to follow this  
Dave84311

DirectX Sprite Issues

Recommended Posts

Dave84311    154
I have a bit of an issue with DirectX. I have been working on a MMO for a while now. Recently, I have been working on graphics, I wrote an engine from scratch that uses 3D planes and prints textures on them. However an issue with the memory usage of these textures arises. Loading a normal PNG file at a 1024 x 1024 dimension, uses around 5 megs a PNG (In memory). Loading more then 20 PNGs is around 100 megs (In memory). That however hardly suffices for the number of PNGs needed for a single scene. Anyone know why this happens? I am using Direct-X 8.1... [Edited by - Dave84311 on March 12, 2006 11:17:51 AM]

Share this post


Link to post
Share on other sites
dave    2187
Do you really need teh PNGs at that resolution? If so, jpg might be better, the saving of space would outway the lossy compression.

Dave

Share this post


Link to post
Share on other sites
circlesoft    1178
Once the raw files have been loaded, the data is always in the same format (note a few exceptions, below). This means that it doesn't really matter what file format you use - it is going to take up the same amount of video & system memory. Note that there are a few exceptions to this:

(1) Some file formats have more channels than others. For example, maybe file .xyz doesn't have a certain channel (say it is some grayscale format). Assuming D3DX imports it, D3DX would store it in a format appropriate for it, saving system resources. For example, if it was grayscale, it would probably use D3DFMT_L8, which is a lot smaller than a D3DFMT_A8R8G8B8 format that other files might be loaded into.

(2) .DDS files are loaded into their specialized surfaces. They can provide many speedups at loadtime. Remember that since .DDS files are actual copies of surfaces, D3DX doesn't have to do a whole bunch of re-arranging. It just creates the format specified by the file, copies over the image block, and bam, it's done.

(3) Some file formats have greater precision than others. For example, .HDR formats naturally take up more memory, since they are loaded into floating-point surface formats. Most of the time however, you will be dealing with general 32-bit surfaces.

Personally, I would take file size over lossy compression. I generally use png, tga, or dds.

Share this post


Link to post
Share on other sites
Dave84311    154
Yes memory usage is always a prority vs hard drive space. I tried using gray scale format. It uses about 50% less memory, however the graphics look horrible and well thats hardly enough for such a horrible look. I need to use the D3DFMT_A8R8G8B8 format, 32bit looks the best but for some reason uses an unreasonable ammount of memory.

Anyways, how is the memory resource usage compared to generic files? Load time is no problem, loading 100+ megs in memory wouldn't take more then 2 minutes, but the ammount is a problem. Right now I have all frames of the animation evenly spread out to save me problems with dynamicly loading the frames dimensions and realigning it to be in the proper position so the frames run smoothly. I guess I will do it later to save me problems with too many files, until then I need to figure out how I can exactly save the most memory without killing quality.

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