LYGIA Shader Library

gtaoMultiBounce (lygia/v1.2.0/lighting/common/gtaoMultiBounce)

Returns a color ambient occlusion based on a pre-computed visibility term. The albedo term is meant to be the diffuse color or f0 for the diffuse and specular terms respectively.

Use:

<vec3> gtaoMultiBounce(<float> visibility, <vec3> albedo)

Check it on Github

#ifndef FNC_GTAOMULTIBOUNCE
#define FNC_GTAOMULTIBOUNCE


vec3 gtaoMultiBounce(const in float visibility, const in vec3 albedo) {
    // Jimenez et al. 2016, "Practical Realtime Strategies for Accurate Indirect Occlusion"
    vec3 a =  2.0404 * albedo - 0.3324;
    vec3 b = -4.7951 * albedo + 0.6417;
    vec3 c =  2.7552 * albedo + 0.6903;

    return max(vec3(visibility), ((visibility * a + b) * visibility + c) * visibility);
}

#endif

Use:

<float3> gtaoMultiBounce(<float> visibility, <float3> albedo)

Check it on Github

#ifndef FNC_GTAOMULTIBOUNCE
#define FNC_GTAOMULTIBOUNCE


float3 gtaoMultiBounce(float visibility, const float3 albedo) {
    // Jimenez et al. 2016, "Practical Realtime Strategies for Accurate Indirect Occlusion"
    float3 a =  2.0404 * albedo - 0.3324;
    float3 b = -4.7951 * albedo + 0.6417;
    float3 c =  2.7552 * albedo + 0.6903;

    return max(float3(visibility, visibility, visibility), ((visibility * a + b) * visibility + c) * visibility);
}

#endif

License

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