User Tag List

Results 1 to 32 of 32

Thread: TGA vs PNG (for textures)

  1. #1
    0
    Champion
    Join Date
    Jun 2014
    Posts
    559

    Question TGA vs PNG (for textures)

    I've baked a 2k normal map in Blender and saved as .tga and .png. TGA is 8 MB, PNG is 2.5 MB - and there is no difference in image quality. That's why i'm curious about which format is better to use in Unreal Engine 4. Do you use .tga or .png for your textures? I didn't tried comparing their sizes with diffuse texture yet, so i don't know if there is also such a difference in this case...

  2. #2
    0
    isn't tga uncompressed color format? I would use png's personally.

  3. #3

  4. #4
    0
    Samaritan
    Join Date
    Mar 2015
    Posts
    80
    PNG 24 bit is lossless compression. TGA is uncompressed. There is no difference in quality. If you want to save HDD/SSD space, then use PNG.
    All textures are ultimately converted to a format like DXT or BC7.
    The only thing that might be an issue is PNG w/ alpha. Make sure that the alpha data of PNG properly translates when imported and compressed in UE4.
    If there are issues, then use TGA for any textures that store alpha channels, and PNG for all others.

  5. #5
    0
    Actually, there is a difference between PNG and TGA when it comes to reflections. TGA has better proportions when it comes to texture data for reflections. Replacing png with tga will give your materials better quality as far as reflections.

  6. #6
    0
    Champion




    Join Date
    Mar 2014
    Posts
    757
    Quote Originally Posted by ECGuy15 View Post
    Actually, there is a difference between PNG and TGA when it comes to reflections. TGA has better proportions when it comes to texture data for reflections. Replacing png with tga will give your materials better quality as far as reflections.
    Unless an actual unreal dev says this is true, I highly doubt it.

    _______________

    Personally, .PNG always.
    Never use alpha channels anyway.

    Well.. Unless I use alpha channel, but then I save the file as only using alpha and not use RGB for compression artifact reasons.
    Marketplace content:
    Luos's Modular Cave Pack - 500+ meshes! (try the free version!)
    4 Elements pack! - Both defensive and offensive!
    A Particle A Day project pack 1 - 28 particles, soon to be 56!

    Other content:
    A Particle A Day Project - Soon to be continued! (grr @ real life)
    2016 VFX Showcase & Rad Rodgers VFX Showcase!!

  7. #7
    0
    Is my **** question as well/ As much as I researched. the TGA is better depending on Wat u want..
    Sad isnt it. PBR abd the TGA.PNG is relative. Again with ambiguity term.

    What is PBR
    Physically-based rendering (PBR) is an exciting, if loosely defined, trend in real time rendering lately. The term is bandied about a lot, often generating confusion as to what exactly it means. The short answer is: “many things”, and “it depends”, which is rather unsatisfying, so I have taken it upon myself to try to explain at some length what PBR represents and how it differs from older rendering methods. This document is intended for non-engineers (artists most likely), and will not present any mathematics or code.

    Much of what makes a physically-based shading system different from its predecessors is a more detailed reasoning about the behavior of light and surfaces. Shading capabilities have advanced enough that some of the old approximations can now be safely discarded, and with them some of the old means of producing art. This means both the engineer and the artist should understand the motivations for these changes.

    We’ll have to start with some of the basics so that they are well defined before we begin to highlight what is new, but if you’ll bear with me through the parts you may already know I think you’ll find it well worth the read. You may then want to also check out our own Joe Wilson’s article on creating PBR artwork.
    Diffusion & Reflection

    Diffusion and reflection – also known as “diffuse” and “specular” light respectively – are two terms describing the most basic separation of surface/light interactions. Most people will be familiar with these ideas on a practical level, but may not know how they are physically distinct.

    When light hits a surface boundary some of it will reflect – that is, bounce off – from the surface and leave heading in a direction on the opposing side of the surface normal. This behavior is very similar to a ball thrown against the ground or a wall – it will bounce off at the opposite angle. On a smooth surface this will result in a mirror-like appearance. The word “specular”, often used to describe the effect, is derived from the latin for “mirror” (it seems “specularity” sounds less awkward than “mirrorness”).

    Not all light reflects from a surface, however. Usually some will penetrate into the interior of the illuminated object. There it will either be absorbed by the material (usually converting to heat) or scattered internally. Some of this scattered light may make its way back out of the surface, then becoming visible once more to eyeballs and cameras. This is known by many names: “Diffuse Light”, “Diffusion”, “Subsurface Scattering” – all describe the same effect.

    iThis I coppied so you less learned will learn

    Thanks to ©2016 Marmoset LLC \

    By Jeff Russell Thank you With all respect/ You tausught me everything I know ao far

    The absorption and scattering of diffuse light are often quite different for different wavelengths of light, which is what gives objects their color (e.g. if an object absorbs most light but scatters blue, it will appear blue). The scattering is often so uniformly chaotic that it can be said to appear the same from all directions – quite different from the case of a mirror! A shader using this approximation really just needs one input: “albedo”, a color which describes the fractions of various colors of light that will scatter back out of a surface. “Diffuse color” is a phrase sometimes used synonymously.
    Translucency & Transparency

    In some cases diffusion is more complicated – in materials that have wider scattering distances for example, like skin or wax. In these cases a simple color will usually not do, and the shading system must take into account the shape and thickness of the object being lit. If they are thin enough, such objects often see light scattering out the back side and can then be called translucent. If the diffusion is even lower yet (in for example, glass) then almost no scattering is evident at all and entire images can pass through an object from one side to another intact. These behaviors are different enough from the typical “close to the surface” diffusion that unique shaders are usually needed to simulate them.
    Energy Conservation

    With these descriptions we now have enough information to draw an important conclusion, which is that reflection and diffusion are mutually exclusive. This is because, in order for light to be diffused, light must first penetrate the surface (that is, fail to reflect). This is known in shading parlance as an example of “energy conservation”, which just means that the light leaving a surface is never any brighter than that which fell upon it originally.

    This is easy to enforce in a shading system: one simply subtracts reflected light before allowing the diffuse shading to occur. This means highly reflective objects will show little to no diffuse light, simply because little to no light penetrates the surface, having been mostly reflected. The converse is also true: if an object has bright diffusion, it cannot be especially reflective.

    Energy conservation of this sort is an important aspect of physically-based shading. It allows the artist to work with reflectivity and albedo values for a material without accidentally violating the laws of physics (which tends to look bad). While enforcing these constraints in code isn’t strictly necessary to producing good looking art, it does serve a useful role as a kind of “nanny physicist” that will prevent artwork from bending the rules too far or becoming inconsistent under different lighting conditions.
    Metals

    Electrically conductive materials, most notably metals, are deserving of special mention at this point for a few reasons.

    Firstly, they tend to be much more reflective than insulators (non-conductors). Conductors will usually exhibit reflectivities as high as 60-90%, whereas insulators are generally much lower, in the 0-20% range. These high reflectivities prevent most light from reaching the interior and scattering, giving metals a very “shiny” look.

    Secondly, reflectivity on conductors will sometimes vary across the visible spectrum, which means that their reflections appear tinted. This coloring of reflection is rare even among conductors, but it does occur in some everyday materials (e.g. gold, copper, and brass). Insulators as a general rule do not exhibit this effect, and their reflections are uncolored.

    Finally, electrical conductors will usually absorb rather than scatter any light that penetrates the surface. This means that in theory conductors will not show any evidence of diffuse light. In practice however there are often oxides or other residues on the surface of a metal that will scatter some small amounts of light.

    It is this duality between metals and just about everything else that leads some rendering systems to adopt “metalness” as a direct input. In such systems artists specify the degree to which a material behaves as a metal, rather than specifying only the albedo & reflectivity explicitly. This is sometimes preferred as a simpler means of creating materials, but is not necessarily a characteristic of physically-based rendering.
    Fresnel

    Augustin-Jean Fresnel seems to be one of those old dead white guys we are unlikely to forget, mainly because his name is plastered on a range of phenomena that he was the first to accurately describe. It would be hard to have a discussion on the reflection of light without his name coming up.

    In computer graphics the word Fresnel refers to differing reflectivity that occurs at different angles. Specifically, light that lands on a surface at a grazing angle will be much more likely to reflect than that which hits a surface dead-on. This means that objects rendered with a proper Fresnel effect will appear to have brighter reflections near the edges. Most of us have been familiar with this for a while now, and its presence in computer graphics is not new. However, PBR shaders have made popular a few important corrections in the evaluation of Fresnel’s equations.

    The first is that for all materials, reflectivity becomes total for grazing angles – the “edges” viewed on any smooth object should act as perfect (uncolored) mirrors, no matter the material. Yes, really – any substance can act as a perfect mirror if it is smooth and viewed at the right angle! This can be counterintuitive, but the physics are clear.

    The second observation about Fresnel properties is that the curve or gradient between the angles does not vary much from material to material. Metals are the most divergent, but they too can be accounted for analytically.

    What this means for us is that, assuming realism is desired, artist control over Fresnel behavior should generally be reduced, rather than expanded. Or at the very least, we now know where to set our default values!

    This is good news of a sort, because it can simplify content generation. The shading system can now handle the Fresnel effect almost entirely on its own; it has only to consult some of the other pre-existing material properties, such as gloss and selectivity.
    Qukk stop here. Thank you

    Jeff Russell


    To Read More on this

    https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/
    Last edited by antoniobradiano; 01-08-2017 at 01:50 AM.

  8. #8
    2
    Champion




    Join Date
    Mar 2014
    Posts
    757
    Is my **** question as well/ As much as I researched. the TGA is better depending on Wat u want..
    Sad isnt it. PBR abd the TGA.PNG is relative. Again with ambiguity term.
    nothing in what you quoted stated that TGA is better.
    also, the whole PBR quote has not much to do with the TGA VS PNG conversation.

    so... I am a bit confused.
    Marketplace content:
    Luos's Modular Cave Pack - 500+ meshes! (try the free version!)
    4 Elements pack! - Both defensive and offensive!
    A Particle A Day project pack 1 - 28 particles, soon to be 56!

    Other content:
    A Particle A Day Project - Soon to be continued! (grr @ real life)
    2016 VFX Showcase & Rad Rodgers VFX Showcase!!

  9. #9
    1
    Since when does the format determine the actual output?
    It does not matter if you use png or tga, both formats are losless. The only difference may be in size.
    There's no such thing as "tga has better reflections". If you really think something like this, you have no clue how textures work.

  10. #10
    8
    Champion




    Join Date
    Mar 2014
    Posts
    757
    Quote Originally Posted by Raildex_ View Post
    Since when does the format determine the actual output?
    It does not matter if you use png or tga, both formats are losless. The only difference may be in size.
    There's no such thing as "tga has better reflections". If you really think something like this, you have no clue how textures work.
    Yup, reflections on both are identical.

    Marketplace content:
    Luos's Modular Cave Pack - 500+ meshes! (try the free version!)
    4 Elements pack! - Both defensive and offensive!
    A Particle A Day project pack 1 - 28 particles, soon to be 56!

    Other content:
    A Particle A Day Project - Soon to be continued! (grr @ real life)
    2016 VFX Showcase & Rad Rodgers VFX Showcase!!

  11. #11
    0
    Champion

    Join Date
    Mar 2014
    Posts
    842
    Quote Originally Posted by Luos View Post
    Yup, reflections on both are identical.
    hahaha +100
    Hevedy - Image Tools: https://hevedy.itch.io/imagetools

  12. #12
    1
    Luminary
    Join Date
    Mar 2014
    Posts
    1,527
    The only real difference I've noticed is:

    Photoshops alpha support in PNGs sucks, it will delete information in areas where alpha is 100% transparent, which isn't what you want for texture packing, and it doesn't treat alpha channels for PNGs like it does with TGAs.
    16 bit PNG support varies and isn't universal.

    So personally I use PNGs for everything but 16 bit textures or when I'm using a texture with an alpha channel.

  13. #13
    0
    Something maybe wrong with my Photoshop, but it will not allow me to export PNGs with any alpha, so if I want alpha channels, I use TGAs. However, even though TGAs are large files, they appear much smaller in engine in comparison to my previous textures that were JPEGs.

  14. #14
    0
    i use .PNG by default because its easy, by alpha support from photoshop is non-existent for .PNG. so for alpha'd textures i use .TGA.

    Visit my portfolio: portfolio.jhgrace.com

  15. #15
    0
    This is why I opt for TGA instead of PNG, real pain to texture pack png's, hoping the alpha was packed properly.

  16. #16
    0
    Quote Originally Posted by Luos View Post
    Yup, reflections on both are identical.
    LOL. +100 as well. Super.


    I have done a lot of texturing for gaming including rendering testing.

    TGA or PSD or TIF???
    In the old days...NWN1 it was TGA because it had 4 channels....RGBA which made it excellent for gaming for the alpha transparency.
    These new days TIF (not UE4) and PSD (Yes UE4) are better in my opinion for a RGBA file since they are lossless formats and can be read by these new engines. PSD has some nice added benefits.
    These 4 Channel Textures are really only useful in game design for things you actually must control the alpha transparency directly in script/code. That is about it.
    So let's say for the sake of argument....5% of your textures. For UE4 PSD all the way.

    PNG
    Super nice lossless format that has built in transparency. Some game engines have poor PNG import techniques which require some fiddling with settings to get them working again with transparency. UE4 handles these just fine and they look awesome.
    GIMP (better actually) and Photoshop export PNGs fast and very clean.
    The super benefit here is very large space savings (removed runtime comment but see below for memory and BCn/ASTC VRAM compression techniques). There is no losing here.
    *I have 28gb+ of textures for the game and most are in PNG with very few artifacts in rendering.
    So 95% of all your textures should be in PNG format.

    Please have a read of these for very good compression techniques on VRAM.
    https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx
    https://msdn.microsoft.com/en-us/library/windows/desktop/hh308955(v=vs.85).aspx
    http://www.reedbeta.com/blog/understanding-bcn-texture-compression-formats/
    https://developer.nvidia.com/astc-texture-compression-for-game-assets
    Last edited by Olander; 01-27-2017 at 12:11 AM. Reason: Updated Info and changed runtime comment.

  17. #17
    0
    JPEG is the way to go. They are very small!!!!11111oneeleven

  18. #18
    0
    TGA is better for textures where you use alpha channel.

  19. #19
    0
    Luminary
    Join Date
    Mar 2014
    Posts
    1,527
    Quote Originally Posted by Olander View Post
    The super benefit here is very large space savings which also help runtime memory as well. There is no losing here.
    So 95% of all your textures should be in PNG format.
    That's incorrect, textures get converted to DXT or BC5 formats for games, UE4 does this automatically. Very rarely do textures need to be uncompressed.

  20. #20
    0
    Quote Originally Posted by ZacD View Post
    That's incorrect, textures get converted to DXT or BC5 formats for games, UE4 does this automatically. Very rarely do textures need to be uncompressed.
    And that's a problem. I wished assets would be just references to any kind of textual or binary data files, so we could use any format we like and actually see what raw data is inside.
    I'm not a fan of 'everything is a UASSET'.

  21. #21
    0
    PNG
    - Smaller file size (lossless compression)
    - Less control over transparency since it's not stored as a separate channel.
    - Modifying transparency is a pain in the *** in PS.

    TGA
    - Larger file size (uncompressed)
    - Full control over transparency, since it has a discrete alpha channel.
    - Modifying transparency is easy in PS.

    TIFF
    - Large-Small File size (can use compressed or uncompressed, lossless)
    - Full control over transparency, due to discrete alpha channel.
    - Modifying transparency is easy in PS.

    PSD
    - Usually, huge file size (contains all info as layers, as well as channels for each layer).
    - Full control over everything, if it's a layer.

    ^ The only differences that matter.

    Compression and size makes no difference whatsoever to your runtime game speed, since everything is uncompressed then converted to DXT/BC7/RGBA format anyway when imported. TGA is the preferred format for most people since it has a discrete alpha channel that you can bring into something like PS and modify it there, and since it's uncompressed it's also faster to open and save (not that that's an issue for modern PC's usually), AND textures can be rebuilt faster in UE4.

    File size only makes a difference to the amount of space your EDITOR project takes up on disc, NOT the packaged game. For consistencies sake, I'd stick to TGA personally, but TIFF is a good format if your conscious of source control / disk space.

  22. #22
    0
    Luminary
    Join Date
    Jul 2014
    Posts
    1,690
    Also on the "pro" side of TGA:
    It only has a simple 18 byte header. So its a nice format for creating custom texture creating/editing tools..

  23. #23
    0
    Champion




    Join Date
    Mar 2014
    Posts
    757
    I prefer to avoid alpha channels where possible, because they get their own unique compression while RGB gets combined together.
    Resulting in an alpha channel taking up the same amount of space/memory as RGB combined.

    for that reason I tend to combine three Alpha channels into a new RGB texture. (or if I dont need metal, put the mask in the M of RMA)
    that can actually save quite a bit of size over the course of a project.

    that said, if I do need a very crisp grayscale or mask, I use the alpha channel.
    Occasionally I even save a seperate grayscale or mask with the alpha-only compression, removing the RGB info so if I do need to use the grayscale/mask in multiple materials, it doesn't need to load useless RGB info.
    Marketplace content:
    Luos's Modular Cave Pack - 500+ meshes! (try the free version!)
    4 Elements pack! - Both defensive and offensive!
    A Particle A Day project pack 1 - 28 particles, soon to be 56!

    Other content:
    A Particle A Day Project - Soon to be continued! (grr @ real life)
    2016 VFX Showcase & Rad Rodgers VFX Showcase!!

  24. #24
    0
    Somewhat related:
    Is it possible to have uncompressed textures in a cooked build?

  25. #25
    0
    Champion




    Join Date
    Mar 2014
    Posts
    757
    Quote Originally Posted by Raildex_ View Post
    Somewhat related:
    Is it possible to have uncompressed textures in a cooked build?
    yes.
    there are uncompressed options.
    Marketplace content:
    Luos's Modular Cave Pack - 500+ meshes! (try the free version!)
    4 Elements pack! - Both defensive and offensive!
    A Particle A Day project pack 1 - 28 particles, soon to be 56!

    Other content:
    A Particle A Day Project - Soon to be continued! (grr @ real life)
    2016 VFX Showcase & Rad Rodgers VFX Showcase!!

  26. #26
    0
    Luminary
    Join Date
    Jul 2014
    Posts
    1,690
    for that reason I tend to combine three Alpha channels into a new RGB texture.
    However that has the drawback that you use up one more texture sampler node.
    Especially in layered materials I tend to use the alpha channel.

  27. #27
    0
    Champion




    Join Date
    Mar 2014
    Posts
    757
    Quote Originally Posted by KVogler View Post
    However that has the drawback that you use up one more texture sampler node.
    Especially in layered materials I tend to use the alpha channel.
    as a vfx guy, thats the least of my worries hehe.
    but yea, from a layered material pov I can fully understand that problem.
    Marketplace content:
    Luos's Modular Cave Pack - 500+ meshes! (try the free version!)
    4 Elements pack! - Both defensive and offensive!
    A Particle A Day project pack 1 - 28 particles, soon to be 56!

    Other content:
    A Particle A Day Project - Soon to be continued! (grr @ real life)
    2016 VFX Showcase & Rad Rodgers VFX Showcase!!

  28. #28
    0
    Quote Originally Posted by ZacD View Post
    That's incorrect, textures get converted to DXT or BC5 formats for games,
    Sort of incorrect (there is really no difference in the Pixel Quality between TGA and PNG thank you for the correction), there are options to not do so but also BCn has compression techniques associated with them that record the texels in a texture. So in essence whether the texture is TGA, PSD, TIF, PNG, JPG or whatever the texture quality, texture size, and pixel depth are what is important. This Does have a large input into what it used in VRAM....think unoptimized texture fill rates.

    The argument here is TGA vs PNG in game dev...UE4 more specifically. If you have good textures then you will get good compression in the BCn with little to no artifacts. When you have a large game being designed then having TGA or PSD as your bulk of textures then space is simply being wasted for no reason. TGA still has a place but just not the bulk of the textures.

  29. #29
    0
    Samaritan
    Join Date
    May 2015
    Posts
    121
    Quote Originally Posted by ECGuy15 View Post
    Actually, there is a difference between PNG and TGA when it comes to reflections. TGA has better proportions when it comes to texture data for reflections. Replacing png with tga will give your materials better quality as far as reflections.
    I'd really like to hear the reasoning behind this - it's the first I've heard of it.

  30. #30
    0
    Quote Originally Posted by duke22 View Post
    I'd really like to hear the reasoning behind this - it's the first I've heard of it.
    Runtime does not know what format texture was before it's converted to UASSET. Only difference is that TGA has better alpha support. So if that alpha channel is used for roughness or specular then it might affect.

  31. #31
    0
    The TGA image file format does support compression.
    But whether UE4 supports the compressed TGA format I have not tested it.
    TGA compression is lossless RLE (run length encoded). So it typically doesn't offer much compression in size unless the image has large regions of the same pixel values.
    PNG compression is lossless DEFLATE (similar to Zip). So it typically can compress complex images fairly well.
    Both image formats are not relevant to what actually ends up in-game, as the bitmap image from the graphics file is converted for use in the engine.
    There are some variations between the two image formats for support of pixel types and alpha channels.
    Demenzun Media Inc. - TerreSculptor Terrain Software http://www.demenzunmedia.com/home/terresculptor/ - TerreSculptor Forums http://www.demenzunmedia.com/forums/

  32. #32
    0
    Infiltrator
    Join Date
    Mar 2015
    Posts
    21
    I know that UE4 will export textures in the Targa format. So that would give me more reason to believe in using it for my textures. However, I wouldn't make that my sole argument.
    Level Designer @ Avalon Games LLC, “The man who asks a question is a fool for a minute, the man who does not ask is a fool for life.” - Confucius

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •