Advantages and disadvantages of different texture file types

Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
Post Reply
User avatar
halbe
Posts: 39
Joined: 14 Feb 2017, 03:55

Advantages and disadvantages of different texture file types

Post by halbe » 19 Jun 2017, 06:07

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.

raven
Posts: 47
Joined: 26 May 2016, 09:54

Re: Advantages and disadvantages of different texture file types

Post by raven » 19 Jun 2017, 08:10

GPUs have hardware decoders for DDS(S3TC). So you not only save HDD space, but also GPU memory.

User avatar
psi29a
Posts: 3392
Joined: 29 Sep 2011, 10:13
Github profile: https://github.com/psi29a/
Contact:

Re: Advantages and disadvantages of different texture file types

Post by psi29a » 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/

Chris
Posts: 1274
Joined: 04 Sep 2011, 08:33

Re: Advantages and disadvantages of different texture file types

Post by Chris » 20 Jun 2017, 05:17

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
One other thing to note is that MP3 has issues with looping. In particular, the format doesn't allow ending on a specific sample, so if you want a looping sound, MP3s will have a short bit of silence at the end. Ogg, FLAC, and WAV don't have that issue. Note also that, like DDS, Ogg is merely a container and can hold different formats. The usual one is Vorbis, but there are also others like Ogg Speex and Ogg Opus. Speex is designed for compressing voice, while Opus is more of a successor to Vorbis. They're both lossy like Vorbis, but offer better compression rates when used appropriately.

User avatar
halbe
Posts: 39
Joined: 14 Feb 2017, 03:55

Re: Advantages and disadvantages of different texture file types

Post by halbe » 21 Jun 2017, 00:38

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/
Is KTX supported in OpenMW/OSG? Can I make it lossless? If not is there a lossless alternative?

Chris
Posts: 1274
Joined: 04 Sep 2011, 08:33

Re: Advantages and disadvantages of different texture file types

Post by Chris » 21 Jun 2017, 05:54

halbe wrote:
21 Jun 2017, 00:38
Is KTX supported in OpenMW/OSG? Can I make it lossless?
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).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest