viewer.shadows = true; //阴影viewer.shadowMap.enabled = true;viewer.shadowMap.size = 2048*2;viewer.shadowMap.darkness = 0.6;//阴影强度viewer.shadowMap.softShadows = true;viewer.shadowMap.maximumDistance = 10000.0;//设置当前时间,阴影角度随时间变化viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date());

     viewer.shadowMap.darkness = 0.9;//阴影强度let collection = viewer.scene.postProcessStages;let snow = new Cesium.PostProcessStage({name: 'czm_rain',fragmentShader: `uniform sampler2D colorTexture;//输入的场景渲染照片varying vec2 v_textureCoordinates;uniform float vrain;float hash(float x){return fract(sin(x*133.3)*13.13);}void main(void){float time = czm_frameNumber / vrain;vec2 resolution = czm_viewport.zw;vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);vec3 c=vec3(.6,.7,.8);float a=0.4;float si=sin(a),co=cos(a);uv*=mat2(co,-si,si,co);uv*=length(uv+vec2(0,4.9))*.3+1.;float v=1.-sin(hash(floor(uv.x*100.))*2.);float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.;c*=v*b; //屏幕上雨的颜色gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(c,1), 0.5); //将雨和三维场景融合}`,uniforms: {vrain: function () {return 30//value:时间}}});collection.add(snow);

     viewer.shadowMap.darkness = 0.9;//阴影强度let collection = viewer.scene.postProcessStages;let snow = new Cesium.PostProcessStage({name: 'czm_snow',fragmentShader: `uniform sampler2D colorTexture;varying vec2 v_textureCoordinates;uniform float vsnow;float snow(vec2 uv,float scale){   float time = czm_frameNumber / vsnow;float w=smoothstep(1.,0.,-uv.y*(scale/10.));if(w<.1)return 0.;uv+=time/scale;uv.y+=time*2./scale;uv.x+=sin(uv.y+time*.5)/scale;uv*=scale;vec2 s=floor(uv),f=fract(uv),p;float k=3.,d;p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;d=length(p);k=min(d,k);k=smoothstep(0.,k,sin(f.x+f.y)*0.01);return k*w;}void main(void){vec2 resolution = czm_viewport.zw;vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);vec3 finalColor=vec3(0);float c = 0.0;c+=snow(uv,30.)*.0;c+=snow(uv,20.)*.0;c+=snow(uv,15.)*.0;c+=snow(uv,10.);c+=snow(uv,8.);c+=snow(uv,6.);c+=snow(uv,5.);finalColor=(vec3(c));gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.5);}`,uniforms: {vsnow: function () {return 60//value:时间,其他为固定值}}});collection.add(snow);

     viewer.shadowMap.darkness = 0.9;//阴影强度let collection = viewer.scene.postProcessStages;let flog = new Cesium.PostProcessStage({name: 'czm_fog',fragmentShader: `uniform sampler2D colorTexture;uniform sampler2D depthTexture;varying vec2 v_textureCoordinates;uniform float vfog;void main(void){vec4 origcolor=texture2D(colorTexture, v_textureCoordinates);vec4 fogcolor=vec4(0.8,0.8,0.8,0.5);float depth = czm_readDepth(depthTexture, v_textureCoordinates);vec4 depthcolor=texture2D(depthTexture, v_textureCoordinates);float f=(depthcolor.r-0.22)/vfog;if(f<0.0) f=0.0;else if(f>1.0) f=1.0;gl_FragColor = mix(origcolor,fogcolor,f);}`,uniforms: {vfog: function () {return 0.5 //value:强度,其他为固定值}}});collection.add(flog);

cesium实现晴,雨,雾,雪等效果相关推荐

  1. Cesium粒子效果之雨、雪、雾

    Cesium粒子效果之雨.雪.雾 功能简介 气象粒子效果新增 气象粒子效果移除 组件封装 原理介绍 对Cesium的粒子效果理论理解刚入门,如果有表述不正确欢迎指正. 以下代码快主要是利用Cesium ...

  2. unity 模型渐变消失_Unity 雨水滴到屏幕效果

    文章目录 前言 一.实现过程 1.代码 2.代码分步解析 总结 参考 前言 本文主要介绍用unity实现雨水滴到屏幕的效果,文章介绍的是基础实现,读完这篇文章再去实现复杂效果会更得心应手些.我们先看更 ...

  3. unity 随机数_Unity 雨水滴到屏幕效果

    文章目录 前言 一.实现过程 1.代码 2.代码分步解析 总结 参考 前言 本文主要介绍用unity实现雨水滴到屏幕的效果,文章介绍的是基础实现,读完这篇文章再去实现复杂效果会更得心应手些.我们先看更 ...

  4. Unity 雨水滴到屏幕效果

    文章目录 前言 一.实现过程 1.代码 2.代码分步解析 总结 参考 前言 本文主要介绍用unity实现雨水滴到屏幕的效果,文章介绍的是基础实现,读完这篇文章再去实现复杂效果会更得心应手些.我们先看更 ...

  5. cesium 实现地形挖洞的拖动效果

    最近给客户提供了一个Cesium三维土壤地址坡面挖掘的效果Demo,客户又提出来想要拖动这个洞实时查看的效果.如果你正好也想实现可以参考一下下面文章,然后再看本文. Cesium.js 三维土壤地质剖 ...

  6. Weather GAN:实现晴、阴、雾、雨、雪之间的天气状况自由迁移

    分享一篇今天新出的有意思的论文: Weather GAN: Multi-Domain Weather Translation Using Generative Adversarial Networks ...

  7. 第五节 利用Ogre 2.3实现雨,雪,爆炸,飞机喷气尾焰等粒子效果

    本节主要学习如何使用Ogre2.3加载粒子效果.为了学习方便,直接将官方粒子模块Sample_ParticleFX单独拿出来编译,学习如何实现粒子效果. 一. 前提须知 如果参考官方示例建议用最新版的 ...

  8. cesium实现鹰眼地图(三维)效果

    文章目录 1.实现效果 2.实现方法 2.1实现思路 2.2具体实现 2.2.1核心代码 2.2.2样式设置 2.2.3具体调用 Cesium实战系列文章总目录: 传送门 1.实现效果 2.实现方法 ...

  9. cesium实现高亮动态楼栋路线效果

    效果图如下 vue文件如下 ,主要是调用如下方法 mapMixin._c_add_tileset('./mapdata/cesium/ccbuild/tileset.json') // 添加楼栋模型m ...

最新文章

  1. win10 ndk hello_world
  2. 关于动态添加页面(iframe + mhtml)
  3. 口语学习Day2:今天来说说我的小客厅!
  4. Labview串口通信
  5. spring集成kafka
  6. Springboot注册Servlet
  7. [译]C#8.0中一个使接口更加灵活的新特性-默认接口实现
  8. LeetCode 323. 无向图中连通分量的数目(并查集)
  9. vba上传指定文件ftp服务器
  10. 【OpenCV 例程200篇】31. 图像金字塔(cv2.pyrDown)
  11. 猜字游戏(python版加C语言版)
  12. 损失函数与代价函数区别
  13. 重写ArrayAdapter
  14. java套接字实验总结,实验三、WINSOCK套接字编程实验报告
  15. java quartz 教程_Quartz 教程
  16. 微信小程序文件大小限制
  17. lena图的直方图以及与其他图像的直方图匹配
  18. 5G基站硬件架构及演进研究
  19. 迅捷路由器造成计算机无法上网,迅捷路由器不能上网怎么办
  20. HashSet及LinkedHashSet源码分析(基于JDK1.6)

热门文章

  1. 怎么把html文档转换成doc,Word文档如何把docx格式转换成doc格式
  2. Linux学习网站推荐
  3. 电脑采购杂志电脑采购杂志社电脑采购编辑部2022年第5期目录
  4. 物联网概论(IoT)__Chp4 传感器与无线传感网//WSN
  5. ACM在线评测系统 各大高校的ACM在线测评系统
  6. 微信白名单配置与检验
  7. python文件打开模式的合法组合,python文件操作
  8. 苹果更新提示:已接入无线局域网却提示需要接入
  9. UE4如何使用Left Shift+W增加移动速度
  10. 2020年元旦上海计算机类会议,CARC2020年元旦晚会