LYGIA Shader Library

penner (lygia/lighting/common/penner)

Visual approximation on Penner's paper on preintegrated SSS, Siggraph 2011. https://www.shadertoy.com/view/llXBWn

Dependencies:

Use:

<vec3> penner( <float> NoL, <float> ir )

Check it on Github




#ifndef FNC_PENNER
#define FNC_PENNER

vec3 penner( float NoL, float ir ) {
    float pndl = saturate( NoL);
    float nndl = saturate(-NoL);

    return vec3(pndl) + 
#if defined(PLATFORM_RPI)
           vec3(1.0,0.1,0.01) * 0.7 * pow(saturate(ir*0.75-nndl),2.0);
#else
        //    vec3(1.0,0.1,0.01) * 0.2 * (1.0-pndl)*(1.0-pndl) * pow(1.0-nndl, 3.0/(ir+0.001)) * saturate(ir-0.04);
           vec3(1.0,0.2,0.05) * 0.250 * (1.0-pndl)*(1.0-pndl) * pow(1.0-nndl,3.0/(ir+0.001)) * saturate(ir-0.04);
#endif
}

#endif

License

MIT License (MIT) Copyright 2017 Inigo Quilez

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