Cesium边界掩膜、发光
项目地址
https://github.com/zhengjie9510/webgis-demo
实现效果
核心代码
const glowBorder = new Cesium.Primitive({
geometryInstances: instance,
appearance: new Cesium.PolylineMaterialAppearance({
material: new Cesium.Material({
fabric: {
type: 'MyBorderColor',
uniforms: {
color: new Cesium.Color(0.2, 0.2, 0.8, 1.0),
glowPower: 0.25,
taperPower: 1
},
source: `
uniform vec4 color;
uniform float glowPower;
uniform float taperPower;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);
if (taperPower <= 0.99999) {
glow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));
}
vec4 fragColor;
fragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);
fragColor.a = clamp(0.0, 1.0, glow) * color.a;
fragColor = czm_gammaCorrect(fragColor);
material.emission = fragColor.rgb;
material.alpha = fragColor.a;
return material;
}
`
}
})
}),
allowPicking: false
})
原文地址:https://blog.csdn.net/qq_26610239/article/details/142833936
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!