float pc_cirrus_lD(in vec3 rPos, const int steps, const float cloudThickness) {
    float density       = 0.1;
    vec3 dir            = mix(vec.light, vec.up, timeLightTransition);
        dir             = normalize(mat3(gbufferModelViewInverse)*dir);
    float stepSize      = cloudThickness/steps;
    vec3 rayStep        = dir*stepSize;
        rPos           += vec3(0.0) + rayStep;
    float transmittance = 0.0;

    for (int i = 0; i<steps; i++) {
        transmittance  += pc_cirrusShape(rPos);
        rPos           += rayStep;
    }
    return transmittance*density*stepSize;
}
float pc_cirrus_scatter(in float oD, in vec3 rayPos, const float cloudThickness) {
    float lD            = pc_cirrus_lD(rayPos, 3, cloudThickness);
    float powder        = exp2(-lD);
    float transmittance = exp2(-oD);
    float inscatter     = 1.0-transmittance;
    float phase         = getCloudPhase()*1.5;

    return max(powder*phase*inscatter, transmittance*0.04*(phase*0.5+0.5));
}