Home Technical Talk

File formats for textures

KebabEmperor
polycounter lvl 3
Offline / Send Message
KebabEmperor polycounter lvl 3
Why .exr is not used in games ? Instead people go with targa?
Some say file size is smaller some say bigger compared to png

Also why targa is used instead of png ? Only reason is alpha channel ?

Replies

  • Eric Chadwick
    Legacy, and tool support. PNG alpha has inconsistent tool support.
  • KebabEmperor
    Offline / Send Message
    KebabEmperor polycounter lvl 3
    What about .exr ? Why it is not used in game industry ? Some say file sizes are even smaller 
  • Axi5
    Offline / Send Message
    Axi5 interpolator
    EXR is simple for it's intended use case but for games it's more complicated than necessary. It's designed for rendered export into a compositor. It's closer to a PSD than it is a PNG/TGA, and because of that I'm dubious about claims that it's smaller. Also, file size isn't everything, EXR's decode slower than PNG/TGA typically. Ultimately if you're using Unity/Unreal it gets converted into their internal formats anyway, so in that software it just becomes about:
    What the image is storing.
    How easy is it to generate.

    Compared to PNG and TGA, EXR can store higher bit depth images because colour is stored in 32bit floating point, but even then RAW and HDR have you covered for most cases like landscapes and HDRI's.

    What features of EXR are you interested in? If it's just a size thing, I'd be curious what was said. You might have read something like: "One EXR image with all my layers is smaller than several PNGs of my layers" which could be true, but probably isn't true about a single image. Or are we talking about how a VW Camper Van can overtake a Ferrari if the Ferrari is only doing 30mph? (Not that I'm saying a PNG is a Ferrari)
  • KebabEmperor
    Offline / Send Message
    KebabEmperor polycounter lvl 3
    I am just wondering the 'why's, whats going under the hood. I hate doing stuff without knowing the reason behind it

  • gnoop
    Offline / Send Message
    gnoop sublime tool
    I wonder that too.   A necessity to store  textures in useless  8 bit format  just complicate  asset managment  and make re-using more  of a problem  than it should be.    To bad neither Phshop nor Substance  support exr properly and I have to waste my time searching where the hell is 16 but height of any specific texture  I did year ago.


  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Tga is shit and if you're using it you're doing things wrong.
    Png is good
    Exr is where we should be going- and will be going when substance painter starts to support colour managed output correctly. 


    Png alpha support is shit in Photoshop but that's easily avoided by eliminating Photoshop from your pipeline. 

    Exr support in substance designer  is basic but functional  - you can't do deep images but that has limited utility in game development and beyond that the only trouble I've had is with zbrush (and that is because zbrush is a dick) 
    It's perfectly fine fine for up to 4 channel 32 and 16 bit data 


  • jStins
    Offline / Send Message
    jStins interpolator
    poopipe said:
    Tga is shit and if you're using it you're doing things wrong.
    Can you elaborate on this a bit? Or have a link that goes into more detail? Not that I use TGA or anything of course... Asking for a friend. 
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Tga is ok  just archaic because  of 4 channels max and  8 bit.   So for any asset your are doing  you have to save lots of  extra files to save height and masks .   it's annoying  and makes your typically already super complicated asset management  more complex.   

    Ideally it should be open source format  where you could keep all reusables   and a game engine  picking and packing from an asset what's necessary automatically ?    So exr seems pretty logical.

    For decades people use psd for the purpose.  But gosh  it opens forever in Designer and half of important tools just couldn't read it properly




  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Tga works I suppose but the 8bit limit, lack of general compatibility and the fact that it uses a lossy compression method mean that it is inferior to PNG in every way.

    as gnoop says deep exr is the logical place to go - it was designed for use in vfx pipelines where there was a need to package up multiple images per frame for compositing (exactly was we need for shaders). 
    It supports any number of channels which don't need to all be same resolution (i think precision can vary between channels too but would have to check )  and is open source. 

    The downsides are mainly around tool support since the python libraries are all written for Linux and believe me it's a pig to build for windows
  • Axi5
    Offline / Send Message
    Axi5 interpolator
    That's not correct, TGA can optionally use RLE compression which is lossless, other than that it's uncompressed. PNG is also lossless. EXR gives you a few options including ZIP (same as PNG) so predominantly they're lossless. So quality wise you're not winning anything by choosing one over the other. The only differences in the image quality will be what you put in it (bit depth/colour space).

    For doing VFX, or transport between various software packages I completely agree that EXR is the best way to go. However, If you're taking it to a game engine then you're not gaining anything by choosing EXR really. The thought of a file format with great tool support that carried all your PBR channels in one file is nice for organisational purposes, but at some point you have to separate them into different formats (greyscale, rgb, rgba, bit depth and custom compression settings) to sample them in the shader at which point it's just as logical to import them individually.
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Axi5 said:
    but at some point you have to separate them into different formats (greyscale, rgb, rgba, bit depth and custom compression settings) to sample them in the shader at which point it's just as logical to import them individually.
    It's super annoying  IMO.  I moved to Marmoset from Substance Painter for a single reason only .   Marmoset can read  necessary channel from packed RGBA  without necessity to save, keep and organize gazillion different files.

    Is it so much of a problem  to read  from multi-channel files  before processing  assets into an engine own  in-game  packed formats? 
  • Axi5
    Offline / Send Message
    Axi5 interpolator
    gnoop said:
    Axi5 said:
    but at some point you have to separate them into different formats (greyscale, rgb, rgba, bit depth and custom compression settings) to sample them in the shader at which point it's just as logical to import them individually.
    It's super annoying  IMO.  I moved to Marmoset from Substance Painter for a single reason only .   Marmoset can read  necessary channel from packed RGBA  without necessity to save, keep and organize gazillion different files.

    Is it so much of a problem  to read  from multi-channel files  before processing  assets into an engine own  in-game  packed formats? 
    It's definitely a pain and I agree it could be easier. It's completely possible to do as you suggest, but it comes with it's own organisational problems, and getting all the tools to spit out the expected EXR file (else expect to manage it yourself).

    That's before you get to the bit-depth issue, I thought EXR might be able to store more than just 32bit float but after searching I realised all it can do is 16bit float, 32bit float and 32bit int (that's per channel, i.e. 0 to 4,294,967,296 values of colour). That's a massive amount of colour range, most people don't need all that for hero assets let alone game props. Even 16bit int is overkill outside of normal and height maps (at SDR). So now we just move the problem and say "that's okay the engine will just optimise" but that defeats the point of using them, since we are now reducing the quality of them intentionally and we have to manage that ourselves because we're artists and we're fussy bastards.

    These days everything's getting a live-link plugin anyway and that's ideal because it means we don't need to worry about it anymore, let the developers work out what you need and organise it for you silently.
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Apologies, You're right.  Haven't compressed a tga in a long time. 

    The main hitch is as you say, the tools . There's not much point writing something  to convert a pile of pngs to exr when you could more easily write one that just puts the textures in the right place (building openEXR for windows is a pain in the arse)

    I'm not entirely with you on bit depth  
    More precision going into a process such as compression can and often does improve the quality of the output and of course it comes into play if you're switching colorspaces or compositing textures between export and compiling into your engine. 

    Given how easy it is to produce 16bpp texture data I don't see any downsides to doing it - as long as you're not working on unreal
Sign In or Register to comment.