function compose_hud_all(dir)
    %hsv_correction = [-10/360 -0.1 -0.02];
    hsv_correction = [-10/360 0 0];
    glow_elem = [1 19 20 21 22 23 25 26 27 29];
    img_dark = [];
    img_dark_a = [];
    img_glow = [];

    for i = 1:30
        [img, ~, a] = imread(sprintf('hud_images/%s/hud_%d.png', dir, i));
        img = im2double(img);
        a = im2double(a);

        fprintf('Blending image %d\n', i);
        if any(glow_elem == i)
            if isempty(img_glow)
                img_glow = img;
            else
                img_glow = img_glow + img;
            end
        else
            if isempty(img_dark)
                img_dark = img;
                img_dark_a = a;
            else
                img_dark = img_dark + img;
                img_dark_a = max(img_dark_a, a);
            end
        end
    end
    
    img_glow = cc(img_glow, hsv_correction);
    img_dark = cc(img_dark, hsv_correction);

    %figure
    %imshow(img_hud);
    imwrite(img_glow, sprintf('hud_images/%s/hud_glow.png', dir));
    imwrite(img_dark, sprintf('hud_images/%s/hud_dark.png', dir), 'Alpha', img_dark_a);
    
    function img = cc(img, hsv_correction)
        img = rgb2hsv(img);
        img = bsxfun(@plus, img, reshape(hsv_correction, 1, 1, 3));
        img(:, :, 1) = wrap_num(img(:, :, 1), 0, 1);
        img = hsv2rgb(img);
    end
    
    function n = wrap_num(n, l, h)
        n = n - h * floor((n + l) / h);
    end
end