Billboards blending issue

Hi,

I have multiple billboards with alpha. From some camera positions I can see not billboard that behind, but sky or terrain.

Looks like billboards sort incorrectly by distance to camera at that moment .

We could reproduce that issue in sandcastle:

    viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
        billboard : {
            image : '../images/facility.gif',
             scale : 10,
            scaleByDistance : new Cesium.NearFarScalar(1.5e2, 2.0, 1.5e7, 0.5)
        }
    });
        viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
        billboard : {
            image : '../images/facility.gif',
            scale : 10,
            scaleByDistance : new Cesium.NearFarScalar(1.5e2, 2.0, 1.5e7, 0.5)
        }
    });

    viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03882),
        billboard : {
            image : '../images/facility.gif',
            scale : 10,
            scaleByDistance : new Cesium.NearFarScalar(1.5e2, 2.0, 1.5e7, 0.5)
        }
    });

    viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03881),
        billboard : {
            image : '../images/facility.gif',
            scale : 10,
            scaleByDistance : new Cesium.NearFarScalar(1.5e2, 2.0, 1.5e7, 0.5)
        }
    });

    viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03880),
        billboard : {
            image : '../images/facility.gif',
            scale : 10,
            scaleByDistance : new Cesium.NearFarScalar(1.5e2, 2.0, 1.5e7, 0.5)
        }
    });

And rotating camera around these 5 billboards. In some camera positions thorough alpha-zones we can see not billboard that behind but sky and ground.

Is there any workaround?

This is a known issue, see https://github.com/AnalyticalGraphicsInc/cesium/issues/2130 for details.

There is a branch billboard-transparency that has a potential fix, but it will most likely have a large negative affect on performance. The branch is also really out of date. I know Patrick and Dan have plans to fix this “the right way” somewhere down the line, but there’s no specific timeline. I updated the issue with this thread so we remember to update it once the problem is fixed.

Thanks again for report and code example. Dan fixed this in #4886. It will be in the Cesium 1.30 release next Tuesday, February 1.

Patrick