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…

3 Likes

isn’t tga uncompressed color format? I would use png’s personally.

I always use tga textures (it’s a habit ^^)

For the differences/other opinions:

  • ://www.polycount/forum/showthread.php?t=112149
  • ://www.digitaltutors/forum/showthread.php?20996-TGA-v-TIFF-v-PNG

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.

2 Likes

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.

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 ’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/

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.

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.

https://i.gyazo/d41c938adf1682588ff47883ec034f6f.jpg

7 Likes

hahaha +100

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.

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.

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.

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

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/en-us/library/windows/desktop/bb694531(v=vs.85).aspx
https://msdn.microsoft/en-us/library/windows/desktop/hh308955(v=vs.85).aspx
://www.reedbeta/blog/understanding-bcn-texture-compression-formats/
https://developer.nvidia/astc-texture-compression-for-game-assets

2 Likes

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

TGA is better for textures where you use alpha channel.

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’.