Eric_freestyle 2022-05-14 16:19
浏览 246
已结题

Cesium天际线优化后处理

let edgeDetection = Cesium.PostProcessStageLibrary.createEdgeDetectionStage()
console.log(edgeDetection.fragmentShader)
let postProccessStage = new Cesium.PostProcessStage({
name: '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(${r},${g},${b},1.0);` +
            '}' +
        '}'

})

let postProccessStage1 = new Cesium.PostProcessStage({
name: '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 == ${r} && redcolor.g == ${g} &&redcolor.b == ${b}){` +
            `gl_FragColor = mix(color, vec4(${r},${g},${b},1.0), silhouetteColor.a);` +
            '}' +
            'else{' +
            'gl_FragColor = color;' +
            '}' +
        '}',
uniforms: {
  redTexture: postProccessStage.name,
  silhouetteTexture: edgeDetection.name
}

})

目前仅实现了换色,天际线默认显示的线太细了,有没有什么方法能够调整天际线显示的默认线宽

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 5月22日
    • 创建了问题 5月14日

    悬赏问题

    • ¥20 有偿,学生成绩信息管理系统
    • ¥15 Arduino电机和openmv连接异常
    • ¥15 Arcgis河网分级报错
    • ¥200 java+appium2.1+idea
    • ¥20 请帮我做一个EXE的去重TXT文本
    • ¥15 工价表引用工艺路线,应如何制作py和xml文件
    • ¥15 根据历史数据,推荐问题类型
    • ¥15 需要仿真图,简单的二阶系统实例
    • ¥15 stm32光控照明仿真
    • ¥15 使用人工智能的方法生成满足一定统计参数要求的随机数序列