Search Unity

Grayscale files

Discussion in 'General Graphics' started by joaobsneto, Apr 25, 2017.

  1. joaobsneto

    joaobsneto

    Joined:
    Dec 10, 2009
    Posts:
    152
    Hi guys,

    I have a question about how Unity handle grayscale files. I'm looking at Unity example projects and all occlusion map files are png files with RGB channels. In the Import settings there is no option to tell that this texture is grayscale image. Then my doubt is how does Unity handle that?

    I did the following test, I got one occlusion map that was originally a RGB 1024x1024 png file (1.3 mb with normal quality compression and 5.3 mb with no compression) an saved it as a tif grayscale image and now it's with 0.7 mb with normal quality compression and 4.0mb with no compression. I don't know where this difference comes from, but shouldn't source file format have no impact in Unity imported size file, or am I wrong?

    If I get a smaller file in the editor, will it be smaller file in the build, right? Why is it no a standard to use grayscale files? Does it send all the 3 channels to video card and then the shader just consider one channel? Or will it send just one channel if the shader request one channel of the image?

    I know that Smothness is stored in the alpha channel of Albedo or Specular maps, which is a pretty good approach to use just one channel. Couldn't the same approach be used for Occlussion and Height maps?

    I'm interested in the inner workings for general optimization, I'm not facing a problem with memory, but it could be a great advantage to send 1 channel instead of 3 for each occlussion map in a game, it's like 66% less in memory use, or am I wrong?