fragment main {

    omw_In vec2 omw_TexCoord;

    void main()
    {
        const float multiplier = 0.14;

        vec2 offset = omw_GetDistortion(omw_TexCoord).rg;
        offset *= multiplier;
        offset = clamp(offset, vec2(-1.0), vec2(1.0));

        float occlusionFactor = omw_GetDistortion(omw_TexCoord+offset).b;

        omw_FragColor = mix(omw_GetLastShader(omw_TexCoord + offset), omw_GetLastShader(omw_TexCoord), occlusionFactor);
    }
}

technique {
    description = "Internal refraction shader for OpenMW";
    version = "1.0";
    author = "OpenMW";
    passes = main;
    flags = hidden;
}
