HLMS Materials        
Print

High Level Materials System (HLMS)

HLMS is the new material system replacing the old material system of earlier Ogre versions. This doesn't mean that the old material system is completely gone, but for most of the cases the HLMS materials are sufficient. The HLMS system is extendable, e.g. you can implement a 'skin' or 'fur' HLMS yourself. Ogre includes two HLMS flavours out-of-the-box:

  • PBS - Physically Based Shading; an approach for materials and rendering that creates more accurate and predictable results than previous game rendering techniques. See Polycount wiki(external link) for more information.
  • Unlit - Unlit rendering; the textures in the material are not affected by light.

Image
Note, that there are 2 other HLMS implementations named PbsMobile and UnlitMobile. They are used for GLES2 rendering and may not be completely on-par with the regular Pbs and Unlit versions.

Materials can be loaded and saved as a file, but unlike the previous material system, the format of the HLMS material file is Json. Example:

{
    "samplers" :
    {
        "Sampler_3" :
        {
            "min" : "anisotropic",
            "mag" : "anisotropic",
            "mip" : "anisotropic",
            "u" : "wrap",
            "v" : "wrap",
            "w" : "wrap",
            "miplodbias" : 0,
            "max_anisotropic" : 1,
            "compare_function" : "disabled",
            "border" :[1, 1, 1, 1],
            "min_lod" : -3.40282e+38,
            "max_lod" : 3.40282e+38
        }
    },

    "macroblocks" :
    {
        "Macroblock_0" :
        {
            "scissor_test" : false,
            "depth_check" : true,
            "depth_write" : true,
            "depth_function" : "less_equal",
            "depth_bias_constant" : 0,
            "depth_bias_slope_scale" : 0,
            "cull_mode" : "clockwise",
            "polygon_mode" : "solid"
        }
    },

    "blendblocks" :
    {
        "Blendblock_0" :
        {
            "alpha_to_coverage" : false,
            "blendmask" : "rgba",
            "separate_blend" : false,
            "src_blend_factor" : "one",
            "dst_blend_factor" : "zero",
            "blend_operation" : "add"
        }
    },

    "pbs" : 
    {

        "aluminium" :
        {
            "macroblock" : "Macroblock_0",
            "blendblock" : "Blendblock_0",
            "shadow_const_bias" : 0.01,
            "workflow" : "metallic",
            "diffuse" :
            {
                "value" : [1, 1, 1],
                "background" : [1, 1, 1, 1]
            },
            "specular" :
            {
                "value" : [1, 1, 1]
            },
            "metallness" :
            {
                "value" : 0.38
            },
            "normal" :
            {
                "value" : 1.03,
                "texture" : "aluminum_normal.png",
                "sampler" : "Sampler_3"
            },
            "roughness" :
            {
                "value" : 1,
                "texture" : "aluminum_roughness.png",
                "sampler" : "Sampler_3"
            },
            "reflection" :
            {
                "texture" : "Tantolunden.dds",
                "sampler" : "Sampler_3"
            }
        }
    }
}

 

Material structure

A material consists of a certain structure:
Datablock; this is basically the definition of a specific material and contains individual information about that material. It can 'consist' of:
    |_ Samplerblock (0..32); a sampler block contains the properties of a texture map. A texture map is represented by an image, usually loaded from a .png or .jpg file.
    |_ Macroblock (0..32); describes the rasterizer state and includes properties such as depth check, depth write, cull mode, ... Macrcoblocks may be shared between datablocks.
    |_ Blendblock (0..32); also describes the rasterizer state, but is separated from macroblocks because of sorting of transparent materials. Blendblocks may be shared between datablocks.

 

Pbs

The Pbs material is probably the most used material type. It is build up by using different texture maps:

  • Diffuse map; wraps the texture image onto the 3D geometry surface while displaying its original pixel color.
  • Normal map; the textures' color representation affects surfaces (bumps, scratches, ...) while providing higher degrees of detail. Sometimes used by the name 'albedo'.
  • Specular / Metallic map; when in metal workflow, the texture is used as a metallic texture and is expected to be a monochrome texture. When in specular workflow, the texture is used as a specular texture, and is expected to be either coloured or monochrome.
  • Roughness map; the roughness map describes the surface irregularities that cause light diffusion. Rougher surfaces will have larger and dimmer looking highlights. Smoother surfaces will keep specular reflections focused, which can appear to look brighter or more intense even though the same total amount of light is reflected.
  • Detail weight map; provides a mask to cover detail maps over the mesh, by controlling weight of each of the 4 maps via the RGBA channels of the weight map. 'R' controls the detail map 0, 'G' the detail map 1, 'B' the detail map 2, and 'A' the detail map 3.
  • Detail map 0; is placed on top of the diffuse map. There can be max. 4 detail maps.
  • Detail map 1; same
  • Detail map 2; same
  • Detail map 3; same
  • Detail normal map 0; additional normal map, placed on top a a regular normal map. There can be max. 4 detail normal maps.
  • Detail normal map 1; same
  • Detail normal map 2; same
  • Detail normal map 3; same
  • Environment probe map; environment probe map is also referred to as Reflection map. The image map is projected onto a 3D surface to represent a reflection of the environment.

Unlit

An Unlit material is used in cases where not lighting effect is needed. It is constructed by using up to 16 different texture maps.

Material workflow

Ogre V2 support three basic types of workflow: Specular workflow, Specular as fresnel workflow and Metallic workflow. The types of workflow are explained in more detail in PBR Guide volume 2(external link)
(See also PBR Guide volume 1(external link) for the first part of the PBR guide).

 

Tools

There is a material editor, that can be used to create HLMS materials. It supports creation of Pbs and Unblit materials. See HLMS Editor source(external link) and HLMS Editor Windows setup(external link)

Create your own Hlms

TODO


Contributors to this page: spookyboo26 points  .
Page last modified on Friday 14 of April, 2017 12:45:22 UTC by spookyboo26 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.