首页 > 其他分享 >Cesium 与 Babylon.js 可视化 glsl 特效篇(十八)

Cesium 与 Babylon.js 可视化 glsl 特效篇(十八)

时间:2023-03-25 16:07:14浏览次数:37  
标签:glsl noise float babylonjs 0.5 js cesium vec2 Cesium


我决定不从Babylonjs 基础来讲了 直接整合cesium与babylonjs可视化来讲

我整合一个类库 后续不断更新中

npm i @haibalai/cesium-babylonjs

初始化cesium -babylonjs 类库, map 是cesium 的viewer对象

import { BabylonMapManager } from “@haibalai/cesium-babylonjs”;
 BabylonMapManager.init(map);添加特效
import { BabylonMapManager } from “@haibalai/cesium-babylonjs”;
 const fragmentShader = `
 precision highp float;
 uniform float iTime;
 const vec2 iResolution = vec2(1.0,1.0);
 varying vec2 vUv;
 const mat2 m = mat2( 0.80, 0.60, -0.60, 0.80 );
 floatnoise( in vec2 p )
 {
 return sin(p.x)sin(p.y);
 }
 floatfbm4( vec2 p )
 {
 float f = 0.0;
 f += 0.5000noise( p ); p = mp2.02;
 f += 0.2500noise( p ); p = mp2.03;
 f += 0.1250noise( p ); p = mp2.01;
 f += 0.0625noise( p );
 return f/0.9375;
 }
 floatfbm6( vec2 p )
 {
 float f = 0.0;
 f += 0.500000(0.5+0.5noise( p )); p = mp2.02;
 f += 0.250000(0.5+0.5noise( p )); p = mp2.03;
 f += 0.125000(0.5+0.5noise( p )); p = mp2.01;
 f += 0.062500(0.5+0.5noise( p )); p = mp2.04;
 f += 0.031250(0.5+0.5noise( p )); p = mp2.01;
 f += 0.015625(0.5+0.5*noise( p ));
 return f/0.96875;
 }
 vec2 fbm4_2( vec2 p )
 {
 return vec2(fbm4§, fbm4(p+vec2(7.8)));
 }


Cesium 与 Babylon.js 可视化 glsl 特效篇(十八) - 小专栏


标签:glsl,noise,float,babylonjs,0.5,js,cesium,vec2,Cesium
From: https://blog.51cto.com/u_15142957/6149511

相关文章