Sign in to follow this  

texture question

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

Hi all. I'm mostly using png files because of transparency and good compression. But I don't really understand in which manner are stored textures in memory. Does DirectX use some intern method of texture data storing? Like does jpg images are uncompressed in memory and copied as uncompressed data in memory? And if this is not true, what kind of texture is best to use? Do compressed textures reduce speed of rendering (because of uncompressing)? Thanks in advance

Share this post


Link to post
Share on other sites
Most methods for storing images (BMP, TGA, JPG, PNG, GIF, etc), are not used directly in textures. Before, it was all straight pixels (it was stored per pixel, per color, in a big buffer). Any time you copied an image to a texture, you had to decode it to the target format (color format, 16bpp, 24bpp, 32bpp, etc), on a per pixel basis (if the texture was 32x32, then you actually had 32x32 pixels to work with, unlike compressed formats where you have less pixels then the size of the image).

Modern video cards do support different compression schemes, but these are all hardware accelerated. I don't know the internals of compression/decompression, but they are methods that are optimized as to not take much extra time over using a straight uncompressed texture (unlike formats like JPG which can take a moment to decompress). The simplest solution for uploading is to use a 3rd party library (like D3DX for Direct3D), load your image, convert to 32bpp uncompressed, then let the library convert it to your target texture format.

When it comes to input image data, it depends on what quality you want, and your size restraints. Some compressed formats are lossy (like JPG), so using them will result in reduced image quality when rendering, regardless of what format your textures are in. Many newer games are using TGA (or DDS) as it's not compressed (or allows lossless compression), while still being able to store the alpha channel (which many games are using now). This means that it's possible to preserve the full quality of the image when rendering, or scale down to fit the system requirements, as needed.

Share this post


Link to post
Share on other sites
Thank you for your reply.
I understand fully what you wrote, but one thing I think that I'm not understand clearly. Fore example I want to use R8G8B8 texture format but because of low-end machine on which is a game installed, I convert texture to R5G6B5 format (less memory). But that texture will look somehow different, ain't it? Or I need to create texture for few texture formats, like one for high-end machines, low-end machines, and then load appropriate texture?

Share this post


Link to post
Share on other sites

This topic is 4199 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.

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