float lc_shape(in vec3 pos, const bool isLightPass) {
    const float size        = 0.012;
    const float lowEdge     = lc_altitude-lc_depth/2+8.0;
    const float highEdge    = lc_altitude+lc_depth/2-8.0;
    float tick              = animTick*0.06;
    vec3 windTick           = tick*vec3(1.0, -0.3, 0.0);

    float heightGradient    = smoothstep(pos.y, lowEdge, highEdge);

        pos.x          += exp2(heightGradient)*30.0;
        pos.xz          = rotateCoord(pos.xz, pi*0.1);

    vec3 pos2           = pos.xyz;
        pos2.xz         = rotateCoord(pos2.xz, -pi*0.1);

    float offset        = noise3D(pos.xyz, 2.2*size, windTick.xyz*1.8)*3.0;

    #if s_lcDetail>=2
        offset         += noise3D(pos.xyz+offset*6.0, 6.6*size, windTick.xyz*2.1)*1.4;
    #endif

    vec3 posNoise       = pos+(offset-vec3(0.5, 0.0, 0.1))*(14.0+heightGradient*2.0);

    float lowCoverage   = smoothstep(posNoise.y, lowEdge, lowEdge+lc_depth*0.12);
        lowCoverage     = 1.0-lowCoverage;
    float highCoverage  = smoothstep(posNoise.y, highEdge-lc_depth*0.66, highEdge);
        //highCoverage    = pow2(highCoverage);
    float lowFade       = linStep(posNoise.y, lowEdge, lowEdge+lc_depth*0.06);
        lowFade         = pow2(lowFade);
    float highFade      = smoothstep(posNoise.y, highEdge-lc_depth*0.2, highEdge);
        highFade        = 1.0-pow2(highFade);

    float shape     = worley2D(pos.xz, 2.8*size, windTick.xz)*2.0-1.0;
        shape      += perlin2D(pos2.xz, 4.2*size, windTick.xz*1.2)*0.75;
        shape      += worleyVolumeHQ(posNoise.xyz, 13.1*size, windTick.xyz*1.3)*0.7;

        #if s_lcDetail>=3
            shape      += worleyVolume(pos2.xyz, 24.6*size, windTick.xyz*1.3)*0.4;
        #endif

        //shape      += noise3D(posNoise, 11.27*size, -windTick*1.7)*0.025;
        //shape      += noise3D(pos, 15.57*size, -windTick*2.2)*0.03;

        shape      -= 0.7-(s_lcCoverage-1.0);

    #ifdef setBiomeEffects
        float biomeCoverage = 0.3*biomeCold+0.2*biomeHot+0.35*biomeDesert-0.2*biomeTropic+0.35*biomeSnow;
        shape      -= biomeCoverage;
    #endif

        shape      += wetness*0.75;

        shape      *= 1.7;

    float fadeMod   = max(s_lcCoverage, 1.0);
        fadeMod     = pow2(fadeMod)*0.5+fadeMod*0.5;
    
    float coverage  = shape;
        coverage   -= lowCoverage*0.5*fadeMod;
        coverage   -= highCoverage*fadeMod;
        coverage   *= highFade;
        coverage   *= lowFade;

        coverage    = max(coverage*1.5, 0.0);

    return coverage*4.0;
}