Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question Regarding Texture/Map Allocation

Discussion in 'General Graphics' started by howieDoin, Feb 21, 2022.

  1. howieDoin

    howieDoin

    Joined:
    Dec 11, 2016
    Posts:
    17
    So we only have so many texture effect/map slots allotted to us inside of Unity, such as Albedo, Metallic, Normal Map, Height Map, Occlusion, Emission etc.

    Sometimes, when I download a texture package, it will include "properly named" textures/maps, like Albedo, or AO, and then I know where to apply those within Unity when creating my material, because they are blatantly and properly named.

    However, more so than not, I will download a package that, let's say, only has one of the textures, or maps correctly named, like AO, but the rest are not named for any of the available slots within Unity. For instance, Displacement, Roughness, Diffuse, Gloss, or Specular, and there are more than just these five. Those named slots do not exist inside of Unity, when creating a new material.

    At that point, I don't know where to put them.

    So my question is, is there a site, or documentation somewhere, that tells you what map names can/should be placed in the available material slots inside of Unity?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,243
    Unity’s BIRP Standard and URP/HDRP Lit shaders use maps that have been packed in a specific way for use with either metallic or specular color for their PBR (Physically Based Rendering) shading model. If you get maps that aren’t already laid out in the way Unity wants them, they either need to be manually repacked, in some cases modified, and in other cases were made for an incompatible shading model.

    Most game engines will pack multiple kinds of information into the individual RGBA channels of a texture. The reason for all of this packing is each texture is more memory, and also an additional cost to read from on the GPU. Combining them makes things much more efficient, and thus cheaper to render. And for real time rendering every bit counts.

    So here’s a basic rundown of the Standard shader’s packing:
    Albedo: RGB surface color (aka “Albedo” or “Diffuse”), optionally A opacity if using cutout or transparent rendering modes, or A smoothness if no metallic texture is used
    Metallic: R metallic (0 is not metal, 1 is metal, that’s it), A smoothness
    AO: G ambient occlusion

    Because the Metallic texture only uses the R and A channels, you can pack the AO into the G of the metallic texture too, but that’s uncommon.

    There’s also the “Specular Setup” version of the Standard Shader. This swaps the metallic map for a Specular Color texture. This still uses the A for smoothness.

    For offline rendering, channel packing is unusual. They’ll also use different parameters for their materials. Smoothness and Roughness are often just the inverse of each other, but sometimes they don’t match up perfectly. Gloss and Specular may be other names for Smoothness and Specular color, but they might also be maps intended for use with old school blinn-phong shading, in which case “gloss” is a completely arbitrary value specific to the program it was made for. Diffuse is just another name for Albedo. And Displacement can be used as a height map in Unity, as that’s what the displacement map is, a height map, but it’s called that because it’s was used in a program that actually distorts or “displaces” the surface of the model. Unity doesn’t have built in shaders that support displacement.

    So, the TLDR answer is: if the maps aren’t already setup to be used for Unity, there’s a chance you can try to pack them together in Photoshop to make them work, and a chance you’ll just have to paint new ones.
     
  3. howieDoin

    howieDoin

    Joined:
    Dec 11, 2016
    Posts:
    17
    Can't thank you enough for such a clear, concise and detailed answer.

    You can see, from these two screen captures, where the confusion stems from.

    https://i.imgur.com/5sUbvel.png

    https://i.imgur.com/VFBGk9A.png