LYGIA Shader Library

material (lygia/lighting/material)

Generic Material Structure

Dependencies:

Check it on Github






#ifndef STR_MATERIAL
#define STR_MATERIAL
struct Material {
    vec4    albedo;
    vec3    emissive;

    vec3    position;       // world position of the surface
    vec3    normal;         // world normal of the surface

    #if defined(SCENE_BACK_SURFACE)
    vec3    normal_back;    // world normal of the back surface of the model
    #endif

    vec3    ior;            // Index of Refraction
    vec3    f0;             // reflectance at 0 degree

    float   roughness;
    float   metallic;
    float   ambientOcclusion;   // default 1.0
    // float   shadow;             // default 1.0

// #if defined(MATERIAL_HAS_CLEAR_COAT)
    float   clearCoat;
    float   clearCoatRoughness;
    #if defined(MATERIAL_HAS_CLEAR_COAT_NORMAL)
    vec3    clearCoatNormal;    // default vec3(0.0, 0.0, 1.0);
    #endif
// #endif

#if defined(SHADING_MODEL_IRIDESCENCE)
    float   thickness; // default to 300.0
#endif

#if defined(SHADING_MODEL_SUBSURFACE)
    vec3    subsurfaceColor;    // default vec3(1.0)
    float   subsurfacePower;    // default to 12.234
    float   subsurfaceThickness;// default to 1.0
#endif

#if defined(SHADING_MODEL_CLOTH)
    vec3    sheenColor;
#endif

#if defined(SHADING_MODEL_SPECULAR_GLOSSINESS)
    vec3    specularColor;
    float   glossiness;
#endif

// Cache
    vec3    V;
    vec3    R;
    float   NoV;

};
#endif

Dependencies:

Check it on Github






#ifndef STR_MATERIAL
#define STR_MATERIAL
struct Material {
    float4  albedo;
    float3  emissive;

    float3  position;           // world position of the surface
    float3  normal;             // world normal of the surface

    #if defined(SCENE_BACK_SURFACE)
    float3  normal_back;        // world normal of the back surface of the model
    #endif

    float3  ior;                // Index of Refraction
    float3  f0;                 // reflectance at 0 degree 

    float   roughness;
    float   metallic;
    float   ambientOcclusion;   // default 1.0
    // float   shadow;             // default 1.0

    float   clearCoat;
    float   clearCoatRoughness;
    #if defined(MATERIAL_HAS_CLEAR_COAT_NORMAL)
    float3  clearCoatNormal;    // default float3(0.0, 0.0, 1.0)
    #endif

#if defined(SHADING_MODEL_IRIDESCENCE)
    float   thickness; // default to 300.0
#endif

#if defined(SHADING_MODEL_SUBSURFACE)
    float3    subsurfaceColor;    // default float3(1.0)
    float   subsurfacePower;    // default to 12.234
    float   subsurfaceThickness;// default to 1.0
#endif

#if defined(SHADING_MODEL_CLOTH)
    float3  sheenColor;
#endif

#if defined(SHADING_MODEL_SPECULAR_GLOSSINESS)
    float3  specularColor;
    float   glossiness;
#endif

// Cache
    float3 V;
    float3 R;
    float NoV;
};
#endif

Licenses

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository