How to set the width of the line

Hello,
I want to set the width for the red line in the demo picture.
Could someone help me?

This is the sample code.

var collection = viewer.scene.postProcessStages;

var edgeDetection = Cesium.PostProcessStageLibrary.createEdgeDetectionStage();
var postProccessStage = new Cesium.PostProcessStage({
    name: 'czm_skylinetemp',
    fragmentShader: 'uniform sampler2D colorTexture;' +
        'uniform sampler2D depthTexture;' +

        'varying vec2 v_textureCoordinates;' +

        'void main(void)' +
        '{' +
        'float depth = czm_readDepth(depthTexture, v_textureCoordinates);' +
        'vec4 color = texture2D(colorTexture, v_textureCoordinates);' +
        'if(depth<1.0 - 0.000001){'+
        'gl_FragColor = color;' +
        '}'+
        'else{'+
        'gl_FragColor = vec4(1.0,0.0,0.0,1.0);'+
        '}'+
    '}'
    });

var postProccessStage1 = new Cesium.PostProcessStage({
    name: 'czm_skylinetemp1',
    fragmentShader: 'uniform sampler2D colorTexture;' +
        'uniform sampler2D redTexture;' +
        'uniform sampler2D silhouetteTexture;' +

        'varying vec2 v_textureCoordinates;' +

        'void main(void)' +
        '{' +
        'vec4 redcolor=texture2D(redTexture, v_textureCoordinates);'+
        'vec4 silhouetteColor = texture2D(silhouetteTexture, v_textureCoordinates);' +
        'vec4 color = texture2D(colorTexture, v_textureCoordinates);' +
        'if(redcolor.r == 1.0){'+
        'gl_FragColor = mix(color, vec4(1.0,0.0,0.0,1.0), silhouetteColor.a);' +
        '}'+
        'else{'+
        'gl_FragColor = color;'+
        '}'+
    '}',
    uniforms: {
        redTexture: postProccessStage.name,
        silhouetteTexture: edgeDetection.name
    }
});

var postProccessStage2 = new Cesium.PostProcessStageComposite({
    name: 'czm_skyline',
    stages: [edgeDetection, postProccessStage, postProccessStage1],
    inputPreviousStageTexture: false,
    uniforms: edgeDetection.uniforms
});

collection.add(postProccessStage2);
1 Like

@xx5533

Welcome to the community! :grinning: :robot: Where in your code are you updating the width of the outline? Moving forward, it would be helpful to see a sandcastle demo of your work. In the meantime, the following community forum thread addresses updating the outline width of polygons.

I am wondering if a similar technique can be used for your application. I am curious to hear your thoughts.

-Sam