float vc_shape(in vec3 pos, const bool isLightPass) {
    const float size        = 0.01;
    const float lowEdge     = vc_altitude-vc_depth/2+8.0;
    const float highEdge    = vc_altitude+vc_depth/2-8.0;
    float tick              = animTick*0.04;
    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, 4.2*size, -windTick.xyz*1.8)*2.5;

    #ifndef isReflectPass
        #if s_vcDetail>=3
            offset         += noise3D(pos.xyz, 9.6*size, -windTick.xyz*2.1)*1.5;
        #endif
    #endif

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

    float noiseFade     = smoothstep(posNoise.y, lowEdge+15.0, vc_altitude+20.0);
    float invNoiseFade  = 1.0-noiseFade*0.5;

    float lowCoverage   = smoothstep(posNoise.y, lowEdge, lowEdge+vc_depth*0.11);
        lowCoverage     = 1.0-lowCoverage;
    float highCoverage  = smoothstep(pos.y, highEdge-vc_depth*0.66, highEdge);
        //highCoverage    = pow2(highCoverage);
    float lowFade       = linStep(posNoise.y, lowEdge, lowEdge+vc_depth*0.05);
        lowFade         = pow2(lowFade);
    float highFade      = smoothstep(posNoise.y, highEdge-vc_depth*0.15, highEdge);
        highFade        = 1.0-pow2(highFade);

    //float localCoverage = noise2D(pos.xz, 0.035*size, windTick.xz*0.5)*0.5;

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

        #if s_vcDetail>=2
            shape      += worleyVolume(pos2.xyz, 21.2*size, windTick.xyz*1.3)*0.4;
        #endif

    #ifndef isReflectPass

        #if s_vcDetail>=3
            shape      += noise3D(posNoise, 15.57*size, -windTick*2.2)*0.035*invNoiseFade;
        #endif

        #if s_vcDetail>=4
            shape      += noise3D(pos, 11.27*size, -windTick*1.7)*0.04;
        #endif

    #endif


        shape      -= 0.5-(s_vcCoverage-1.0);

    #ifdef setBiomeEffects
        float biomeCoverage = 0.25*biomeCold+0.25*biomeHot+0.65*biomeDesert-0.15*biomeTropic+0.35*biomeSnow;
        shape      -= biomeCoverage;
    #endif
        shape      += wetness*0.5;

        shape      *= 1.7;

    float fadeMod   = max(s_vcCoverage, 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*6.0;
}