float vc_getCoverage(in vec3 pos) {
    float lowErode  = 1.0-sstep(pos.y, vc_lowEdge, vc_lowEdge+s_vcThickness*0.15);
    float highErode = sstep(pos.y, vc_lowEdge+s_vcThickness*0.1, vc_highEdge);
    float lowFade  = sstep(pos.y, vc_lowEdge, vc_lowEdge+s_vcThickness*0.07);
    float highFade = 1.0-sstep(pos.y, vc_highEdge-s_vcThickness*0.3, vc_highEdge);

    //pos.x          += pow3(sstep(pos.y, vc_lowEdge, vc_highEdge))*250;

    vec3 wind       = vec3(vc_tick)*vec3(1.0, 0.0, 0.0);

    #ifdef s_vcLocalCoverage
        float coverage  = getValue2D(pos.xz, 0.1*vc_size, wind.xz*0.0007);
            coverage    = sstep(coverage-wetness, 0.2, 0.9);
    #endif

    float shape     = fbm(pos*vc_size*vc_shapeSize, wind*0.8, 0.36, 2.25, 3);
        shape      -= 1.74;
        shape      += (s_vcCoverage-1.0)*0.2;
        shape      += wetness*0.04;
        #ifdef s_biomeDynamics
        shape      += vc_biomeCoverage*0.1;
        #endif

    #ifdef s_vcLocalCoverage
        shape      -= coverage*0.22;
    #endif
        shape      += vc_daytimeCoverage;

        shape      *= highFade;
        shape      *= lowFade;
        shape      -= lowErode*0.16*s_vcCoverage*lowFade;
        shape      -= highErode*0.3*s_vcCoverage;

    return max(shape, 0.0);
}

float density   = (0.6*timeSunrise+1.0*timeNoon+0.75*timeSunset+0.8*timeNight)*0.9
    #ifdef s_biomeDynamics
    *vcData.y
    #endif
    ;

float vc_getDensityFade(in float x) {
    float dFade     = sqrt(sstep(x, vc_lowEdge, vc_highEdge))*0.8;

    #if s_vcDetail>0
        dFade      += sstep(x, vc_highEdge-s_vcThickness*0.6, vc_highEdge-s_vcThickness*0.9)*0.8;
    #endif
    
        dFade      += 0.05;
    return dFade;
}

float vc_getShape(in vec3 pos, in float coverage) {
    vec3 wind       = vec3(vc_tick)*vec3(1.0, 0.0, 0.0);

    const float size = 100.0*vc_size;

    float dFade     = vc_getDensityFade(pos.y);

    //pos.x          -= pow3(1.0-sstep(pos.y, vc_lowEdge, vc_highEdge))*200;

    float wFade     = (sstep(pos.y, vc_lowEdge, vc_highEdge-s_vcThickness*0.5))*0.5+0.5;
    //float nFade     = sqrt(sstep(pos.y, vc_lowEdge, vc_highEdge-s_vcThickness*0.5))*0.6+0.4;

    float shape     = coverage;

    float div   = 0.0;
    float noise = getSlicedWorley3x(pos, 1.5*size, wind*9)*wFade;     div += 1.0*wFade;

    #if s_vcDetail>1
    //vec3 pos2   = pos+getValue3D(pos, 0.66*size, wind*0.05)*20;
    //vec3 pos2   = pos+coverage*5.0;
        noise  += getSlicedWorley(pos, 7.0*size, wind*8)*0.12;  div += 0.12;
        //noise  += getValue3D(pos2, 1.5*size, wind*0.05)*0.1;   div += 0.2;
    #endif
    
        noise /= div;

        shape  -= (1.0-noise)*0.166;

    return max(shape*dFade*density, 0.0);
}

float vc_getShapeLQ(in vec3 pos, in float coverage) {
    /*
    vec3 wind       = vec3(vc_tick)*vec3(1.0, 0.0, 0.0);

    float shape     = coverage*5.0;

    float size      = 100.0*vc_size;

    float dFade     = vc_getDensityFade(pos.y);

    float wFade     = (sstep(pos.y, vc_lowEdge, vc_highEdge-s_vcThickness*0.4))*0.5+0.5;
    //float nFade     = sqrt(sstep(pos.y, vc_lowEdge, vc_highEdge-s_vcThickness*0.5))*0.6+0.4;

    float div1   = 0.0;
    float noise1 = getSlicedWorley3x(pos, 1.5*size, wind*9);       div1 += 1.0;
        noise1  += getSlicedWorley(pos, 12.0*size, wind*8)*0.125;  div1 += 0.125;
    
        noise1 /= div1;

        shape  -= (1.0-noise1)*0.5*wFade;

        float noise2 = 0.0;
        float div2   = 0.0;

        noise2  += 0.6;     div2 += 1.0;
        noise2  += 0.3;     div2 += 0.5;

        noise2 /= div2;
        shape  -= (1.0-noise2)*0.2;

    return max(shape*dFade*density, 0.0);*/
    return vc_getShape(pos, coverage);
}