Line of sight projections over buildings thru human vision

1. A concise explanation of the problem you're experiencing.

I want to show Line of Sight on 3D buildings with color format projection instead of lines, where human can visible over the buildings in that area.

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

var viewer = new Cesium.Viewer('cesiumContainer');
var thetaMax = 360; //bearing in degrees
var dTheta = 10;
var R = 5000; // distance in meters

var centerLLH = Cesium.Cartographic.fromDegrees(-75.5966, 40.0386 , 0.0);
var centerXYZ = Cesium.Cartographic.toCartesian(centerLLH);

// We'll need the transformation from local coordinates to Earth-Centered, Earth-Fixed
var enuTransform = Cesium.Transforms.eastNorthUpToFixedFrame(centerXYZ);

for (var theta = 0; theta < thetaMax; theta += dTheta) {

    var dX = R * Math.cos(Cesium.Math.toRadians(theta)) ;
    var dY = R * Math.sin(Cesium.Math.toRadians(theta));

    var limitENU = new Cesium.Cartesian4(dX, dY, 0.0, 1.0);
    // Transform point in local coordinate system (East-North-Up) to ECEF
    var limitECF = new Cesium.Cartesian4();
    limitECF = Cesium.Matrix4.multiplyByVector(enuTransform, limitENU, limitECF);

    var glowingLine = viewer.entities.add({
        name : 'Ray at ' + theta + ' degrees ENU',
        polyline : {
            positions : [
            width : 1,
            material : Cesium.Color.ORANGE.withAlpha(0.5),

var centerEntity = viewer.entities.add({
    name: 'Center',
    position: new Cesium.ConstantPositionProperty(centerXYZ),
    point: {
        size: 8

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I want to show Line of Sight on 3D buildings with color format instead of line, where human can visble over the buildings in that area

4. The Cesium version you're using, your operating system and browser.

cesuim 1.39, windows 10

Hi there,

Correct me if I’m wrong, but it sounds like you want to color the buildings themselves. While what you are describing is possible on the globe itself with the Cesium API using a custom Globe Material, I don’t believe it’s possible on buildings without modifying the Cesium source code. In our prototypes we have implemented the line of sight calculations in the shader.



Hi Gabby,

Thanks for the information.

I was trying to project half shade of a building where human vision is possible on building in the line of sight functionality. If there is any functionality to color half of the building till the vision is possible, let me know.



You would need to write custom code to accomplish that. Like I said above, we’ve had success performing the line of sight calculation in the shader’s GLSL code.

Is there an example of that shader GLSL code?

I think what Gabby is referring to here is the visibility features of the commercial Cesium Analytics SDK: (which is not open source).

Yea, I realize that the solution is a part of the non FOSS sdk, I would just like to try it out. We have a solution, and we’re trying a few different methods. I know that a shader is most likely going to be the best solution, but at the time we just don’t have the time to implement a shader.