Jump to content
  • Advertisement
Sign in to follow this  

Texture Questions for a newbie

This topic is 4567 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, I have some newbie questions on textures. Whats the differance between Standard, Cubemap and Volume Textures? Whats the differance between unsigned, signed, floating-point and IEEE floating-point formats? If i selected, for example IEEE Floating-Point 128-bit: A32B32G32R32F does that mean that every texture i use in my engine has to/should all be in the same format. Is that overkill for todays graphics cards? or just in general? Is it feasible? Thanks

Share this post

Link to post
Share on other sites
A regular texture is a 2D array of texels (texture pixels), like any normal BMP, JPG, PNG, TGA, etc. In DX10 there will also be 1D textures, but currently a 1D texture is just a 2D texture with one dimension of 1. Many cards require the dimensions of textures to be power of 2, but not necessarily square (ie: 1x1, 2x2, 4x4, 8x8, 16x16, 32x32, 256x256, 256x512, 1024x32, etc).

Often the texture is made up of multiple surfaces, known as mipmaps, which are usually automatically generated upon loading a texture. Each mipmap is half the size of the previous one. This reduces the work a graphics card must do, when displaying a texture at a smaller size. A 256x256 texture will have 9 mip levels (256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4, 2x2, and 1x1).

A cube texture is like 6 textures put onto the faces of a cube. These require a 3D texture coordinate, such as a direction vector. Commonly used for environment maps. Tell D3D to automatically create reflection vectors for your UVs and when the texture is sampled it will look at the appropriate part of the cube.

A volume texture is another 3D texture type, except instead of being a cube, it's like having a stack of photos on top of each other. In addition to the usual UV (texture xy coords are called UVs) there is a W which chooses which photo to read.

Your backbuffer and each texture can all be different formats. In fact backbuffers can only be a few unsigned formats, listed at the end of the D3DFORMAT entry in the SDK help.

Unsigned formats are integers that are positive, such as D3DFMT_A8R8G8B8 which is 4 unsiged 8 bit numbers. A normal 32 bit bitmap. Newer cards offer 16 bit integer formats. Most cards also offer a 16 bit format like X1R5G5B5 or R5G6B5, which are a mix of 5 and 6 bit unsigned integers. 5 bits = 0..31, 6 bits = 0..63, 8 bits = 0..255, 16 bits = 0..65535

Signed formats such as D3DFMT_U8V8 are just like the unsigned ones, except they hold signed values. In this case 8 bits = -128..127

Floating point formats hold numbers with fractions. For example D3DFMT_R16F will hold a 16 bit float. These are limited to only a few digits of precision and a small upper value, like 16383 or so (the SDK will tell you exactly). Great for HDR images that don't eat up as much space as full floats.

IEEE floats are your standard floats that all modern processors use. They hold the same range and precision as float would in C/++. You likely don't need this precision very often. If you want really accurate shadowmap depths you might use a D3DFMT_R32F to hold a single 32 bit float value.

The smallest format which suits your needs for a particular texture is best, as GPUs are usually memory/fill limited.

There are also compressed textures such as DXT1 through DXT5. These are lossy compression schemes that reduce the memory needed on the GPU. If the quality loss is acceptable (often it is), these are the fastest textures you can use.

Most non 2D textures are stored in DDS format which can hold every texture we've mentioned (2D, Cube, Volume, unsigned, signed, float, and compressed.)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!