export const rainPostStage = (viewer: any) => { // 下雨效果 const fs = 'uniform sampler2D colorTexture;\n varying vec2 v_textureCoordinates;\n \n float hash(float x){\n return fract(sin(x*133.3)*13.13);\n }\n \n void main(void){\n \n float time = czm_frameNumber / 120.0;\n vec2 resolution = czm_viewport.zw;\n \n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n vec3 c=vec3(.6,.7,.8);\n \n float a=-.4;\n float si=sin(a),co=cos(a);\n uv*=mat2(co,-si,si,co);\n uv*=length(uv+vec2(0,4.9))*.3+1.;\n \n float v=1.-sin(hash(floor(uv.x*100.))*2.);\n float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.;\n c*=v*b; \n \n gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(c,1), 0.5); \n }\n '; /* eslint-enable */ const postStage = new Cesium.PostProcessStage({ fragmentShader: fs, uniforms: { highlight() { return new Cesium.Color(1.0, 1.0, 1.0, 0.5) } } }) return viewer.scene.postProcessStages.add(postStage) }
正文
Cesium下雨特效
文章版权声明:除非注明,否则均为
譬如朝露_策温技术开发工作室博客原创文章,转载或复制请以超链接形式并注明出处。
发表评论
侧栏公告
寄语
譬如朝露博客是一个分享前端知识的网站,联系方式11523518。
热评文章
标签列表
热门文章
友情链接