LYGIA Shader Library

specularAO (lygia/lighting/common/specularAO)

Dependencies:

Check it on Github


#if !defined(TARGET_MOBILE) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEBGL)
#define IBL_SPECULAR_OCCLUSION
#endif

#ifndef FNC_SPECULARAO
#define FNC_SPECULARAO
float specularAO(const in float _NoV, const in float _roughness, const in float _ao) {
#if !defined(TARGET_MOBILE) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEBGL)
    return saturate(pow(_NoV + _ao, exp2(-16.0 * _roughness - 1.0)) - 1.0 + _ao);
#else
    return 1.0;
#endif
}

#ifdef STR_MATERIAL
float specularAO(const in Material _M, const in float _ao) {
    return specularAO(_M.NoV, _M.roughness, _ao);
}
#endif

#endif

Check it on Github

#if !defined(TARGET_MOBILE) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEBGL)
#define IBL_SPECULAR_OCCLUSION
#endif

#ifndef FNC_SPECULARAO
#define FNC_SPECULARAO
float specularAO(const in float _NoV, const in float _roughness, const in float _ao)
{
#if !defined(TARGET_MOBILE) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEBGL)
    return saturate(pow(_NoV + _ao, exp2(-16.0 * _roughness - 1.0)) - 1.0 + _ao);
#else
    return 1.0;
#endif
}

#ifdef STR_MATERIAL
float specularAO(const in Material _M, const in float _ao) {
    return specularAO(_M.NoV, _M.roughness, _ao);
}
#endif

#endif

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