What are the things one should consider when choosing which file type to use for textures?
>.dds
Seems to compress pretty well but it is lossy and not widely supported in painting programs like Krita
>.png
Losless and larger file sizes, does it having less compression mean it would load faster?
>.jpg
Since you can specify how much compression, would this be the same as .dds if you compressed it to the same file size? This would be for any textures that don't have alpha, of course.
>.bmp
No compression so I assume this loads very quickly and is obviously lossless, however it's huge so you might as well use .png files.
>.tga
I don't know much about this, Morrowind seems to randomly use it for a bunch of textures and .dds for others, there doesn't seem to be any consistency for how big the textures are in each type or if they have alpha so I'm not sure why either are used.
And are there others worth mentioning?
While I'm at it what about audio types?
>.mp3
Might as well use .ogg
>.ogg
Lossy but compresses well, probably good for music tracks or long atmospheric sounds
>.flac
Lossless and compresses to about 10x the file size of .ogg files, you'd probably use this for sounds that are shorter than music files but longer than tiny sound effects
>.wav
Lossless with no compression, probably ideal for tiny sound effects that get played often.
Advantages and disadvantages of different texture file types
Re: Advantages and disadvantages of different texture file types
GPUs have hardware decoders for DDS(S3TC). So you not only save HDD space, but also GPU memory.
- psi29a
- Posts: 5362
- Joined: 29 Sep 2011, 10:13
- Location: Belgium
- Gitlab profile: https://gitlab.com/psi29a/
- Contact:
Re: Advantages and disadvantages of different texture file types
As raven said, DDS was created to allowing it to be copied as-is directly into GPU memory. The more modern variant of this is ktx[1][2]
They (DDS and KTX) are containers only, the actual pixel format used in a specific file may or may not be supported by a given hardware. The format can be anything from s3tc (dxt3/5) or etc (etc1/etc2) or something else.
All other file types (png/jpg/...) have to be loaded into system memory, cpu has to convert it into a format that the GPU can handle then upload it to GPU memory. This is a slow process, but OpenMW via OSG supports it.
You have the audio pretty much covered, the latency of decoding a mp3 (or something else) would make things weird when you click and expect an audio cue but it happens with a bit of delay.
[1] https://www.khronos.org/opengles/sdk/to ... rmat_spec/
[2] https://www.khronos.org/opengles/sdk/tools/KTX/
They (DDS and KTX) are containers only, the actual pixel format used in a specific file may or may not be supported by a given hardware. The format can be anything from s3tc (dxt3/5) or etc (etc1/etc2) or something else.
All other file types (png/jpg/...) have to be loaded into system memory, cpu has to convert it into a format that the GPU can handle then upload it to GPU memory. This is a slow process, but OpenMW via OSG supports it.
You have the audio pretty much covered, the latency of decoding a mp3 (or something else) would make things weird when you click and expect an audio cue but it happens with a bit of delay.
[1] https://www.khronos.org/opengles/sdk/to ... rmat_spec/
[2] https://www.khronos.org/opengles/sdk/tools/KTX/
Re: Advantages and disadvantages of different texture file types
In regards to sounds, it only needs to be decoded once and is then kept decoded in cache for easy reuse. Using formats like mp3, ogg, or flac do require a some CPU to decode on first use, but once decoded it's kept cached and doesn't need to be decoded again.
- Spoiler: Show
Re: Advantages and disadvantages of different texture file types
Is KTX supported in OpenMW/OSG? Can I make it lossless? If not is there a lossless alternative?psi29a wrote: ↑19 Jun 2017, 08:37 As raven said, DDS was created to allowing it to be copied as-is directly into GPU memory. The more modern variant of this is ktx[1][2]
They (DDS and KTX) are containers only, the actual pixel format used in a specific file may or may not be supported by a given hardware. The format can be anything from s3tc (dxt3/5) or etc (etc1/etc2) or something else.
All other file types (png/jpg/...) have to be loaded into system memory, cpu has to convert it into a format that the GPU can handle then upload it to GPU memory. This is a slow process, but OpenMW via OSG supports it.
You have the audio pretty much covered, the latency of decoding a mp3 (or something else) would make things weird when you click and expect an audio cue but it happens with a bit of delay.
[1] https://www.khronos.org/opengles/sdk/to ... rmat_spec/
[2] https://www.khronos.org/opengles/sdk/tools/KTX/
Re: Advantages and disadvantages of different texture file types
Yes, both DDS and KTX can store raw pixel formats. I don't believe there's a lossless compressed format for them though (DDS and KTX are designed to easily load textures with little overhead, so you won't generally see them using formats that need decompression on load).