Skip to content

Specular Texture Details

Jacob Eriksson edited this page Jun 23, 2020 · 39 revisions

Note that your shaderpack is only required to correctly read the smoothness (red) and f0 (green) data to be labPBR ready. The other specified datasets are optional components. More details about that can be found in the Implementation Requirements.

What each channel represents:

  • Red

    • Represents "perceptual" smoothness.
      • Convert perceptual smoothness to linear roughness with roughness = pow(1 - perceptualSmoothness, 2)
      • Convert linear roughness to perceptual smoothness with perceptualSmoothness = 1 - sqrt(roughness)

    For texture artists : A value of 255 (100%) results in a very smooth material (eg. polished granite). A value of 0 (0%) creates a rough material (eg. rocks).

  • Green

    • Values from 0 to 229 represent F0, also known as reflectance. This attribute is stored linearly. Please note that a value of 229 represents exactly 229 divided by 255, or approximately 90%, instead of 100%.
    • Values from 230 to 255 represent various different metals.
      Details about this range is provided below.

    For texture artists : This can be described as the minimal reflection strength of the material. So a low f0 value results in a less intense reflection when looking directly at the material while a higher f0 value causes a stronger and more visible reflection. Unlike traditional specularity however this is not a multiplier for the reflection strength, meaning that reflections at flat angles will always be stronger (called "Fresnel", more information about that here: Principle of the Fresnel effect )

  • Blue

    • On dielectrics:

      • Values from 0 to 64 represent porosity. Examples of the porosity effect can be found here.
      • Values from 65 to 255 represent subsurface-scattering.
      • Both porosity and subsurface-scattering are stored linearly.
    • On metals:

      • Reserved for future use.

    For texture artists : The porosity value describes how much water a material can absorb. This manifests in the color of the material getting darker and less reflective when wet. This allows for a much more accurate behavior with shaders supporting both porosity and weather based wetness (eg. puddles). Below are some example values.

    Material Porosity Value
    Sand 64
    Wool 38
    Wood 12
    Metals and other impermeable materials 0

    Examples of the porosity effect in action can be found here.

  • Alpha

    • it can have values from 0 to 254, 0 being 0% of emissiveness and 254 being 100%.
    • This is stored linearly.

    For texture artists : the lower the value the less light it will emit, the higher the more luminescent it'll be, but never use a value of 255 since this will cause it to be ignored.

How metals work:

In order to allow a more accurate representation of metals with the limited amount of information that can be provided, certain metals have been predefined and are selected by setting the green channel to specific values from 230 to 254. In these cases, the albedo is used to tint the reflections instead of being used for diffuse shading.
If you want a metal that isn't among the predefined metals, you can also set the green channel to a value of 255. In this case, the albedo will instead be used as the F0. This is less accurate, but often it still gives decent results.

Note that certain shaderpacks may not support these predefined metals, and will treat the entire range from 230 to 255 as though it had a value of 255.

Metal Bit Value N (R, G, B) K (R, G, B)
Iron 230 2.9114, 2.9497, 2.5845 3.0893, 2.9318, 2.7670
Gold 231 0.18299, 0.42108, 1.3734 3.4242, 2.3459, 1.7704
Aluminum 232 1.3456, 0.96521, 0.61722 7.4746, 6.3995, 5.3031
Chrome 233 3.1071, 3.1812, 2.3230 3.3314, 3.3291, 3.1350
Copper 234 0.27105, 0.67693, 1.3164 3.6092, 2.6248, 2.2921
Lead 235 1.9100, 1.8300, 1.4400 3.5100, 3.4000, 3.1800
Platinum 236 2.3757, 2.0847, 1.8453 4.2655, 3.7153, 3.1365
Silver 237 0.15943, 0.14512, 0.13547 3.9291, 3.1900, 2.3808

Reasoning for this specific organization:

For the red and green channels, it is fairly simple:

  • Red represents smoothness in most previous formats, and there isn't a good reason to change that.
  • Green represents metalness in most previous formats. Assigning values for partial metals, while not realistic, could often be used to somewhat control F0.

For the rest, we only had two channels left for emission, porosity, and subsurface-scattering, so two of them had to be stored in the same channel. We chose to have porosity and subsurface-scattering in the same channel.

Finally, placing emission in alpha allows the texture artist to easily make the emissive map separate from the rest and then merge it with _s as the alpha channel later, exactly like we do for parallax (POM) with _n.

Clone this wiki locally