Giter VIP home page Giter VIP logo

cesium-particle's Issues

奇怪的粒子表现

你好,在查看demo的时候发现有几个奇怪的渲染表现想请教一下

  1. 在地图放大到很大的时候,会出现奇怪的白色片状。
    image
  2. 旋涡的渲染效果似乎有点奇怪
    image

作者您好,当相机视锥改变时,有些粒子像是被裁剪了,请问您知道怎么解决吗

这是在正常情况下的截图:
img1

现在移动相机视野,会出现一些粒子被裁剪的情况,如下截图:
img2
如上截图,红色区域以上的屏幕像素的粒子像是被裁剪了一样

预期效果:粒子不被裁剪

个人思考:是不是和深度测试有关系呢,在Wind-Field-Cesium项目中也出现了这个现象

已尝试的几个失败方案:

  1. 尝试修改screenDraw.frag代码成如下:
uniform sampler2D trailsColorTexture;
uniform sampler2D trailsDepthTexture;

varying vec2 textureCoordinate;

void main() {
    vec4 trailsColor = texture2D(trailsColorTexture, textureCoordinate);
    float trailsDepth = texture2D(trailsDepthTexture, textureCoordinate).r;
    float globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, textureCoordinate));

    // - 注释掉以下内容
    // if (trailsDepth < globeDepth) {
    //     gl_FragColor = trailsColor;
    // } else {
    //     gl_FragColor = vec4(0.0);
    // }
    
    // + 增加以下1行语句
    gl_FragColor = trailsColor;
}
  1. 尝试修改trailDraw.frag代码成如下:
uniform sampler2D segmentsColorTexture;
uniform sampler2D segmentsDepthTexture;

uniform sampler2D currentTrailsColor;
uniform sampler2D trailsDepthTexture;

uniform float fadeOpacity;

varying vec2 textureCoordinate;

void main() {
    vec4 pointsColor = texture2D(segmentsColorTexture, textureCoordinate);
    vec4 trailsColor = texture2D(currentTrailsColor, textureCoordinate);

    trailsColor = floor(fadeOpacity * 255.0 * trailsColor) / 255.0; // make sure the trailsColor will be strictly decreased

    float pointsDepth = texture2D(segmentsDepthTexture, textureCoordinate).r;
    float trailsDepth = texture2D(trailsDepthTexture, textureCoordinate).r;
    float globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, textureCoordinate));

    gl_FragColor = vec4(0.0);
    
    // - 注释掉以下内容
    // if (pointsDepth < globeDepth) {
    //     gl_FragColor = gl_FragColor + pointsColor;
    // }
    // if (trailsDepth < globeDepth) {
    //     gl_FragColor = gl_FragColor + trailsColor;
    // }

    // + 增加以下2行语句
    gl_FragColor = gl_FragColor + pointsColor;
    gl_FragColor = gl_FragColor + trailsColor;

    gl_FragDepthEXT = min(pointsDepth, trailsDepth);
}

由于本人刚刚接触webgl不久,烦请忽略我的一些不专业的术语表达。

使用webgl2上下文时粒子不显示

当在viewer中设置请求使用 webgl2 时,场景中不显示粒子了。

cesium 版本1.99,viewer 实例化传入以下参数。

contextOptions: { requestWebGl2: true }

在 cesium 版本1.101 中是这样设置

contextOptions: { requestWebgl1: false }

首先 calculateSpeed.frag 这个文件的第19行报错了,说是全局变量初始化必须是常量表达式

float speedScaleFactor = speedFactor * pixelSize;

将这句注释掉,然后写到对应方法里面去计算,重新打包后渲染不报错了,但是也看不到粒子了。

早期版本(如0.7.0)是否存在Particle3D API中fields字段自定义无效的问题

我尝试用这段代码加载一个字段为u, v, x, y的nc文件,但仍会出现这样的报错信息:‘error NetCDF file no such attribute: U
all variables are: x,y,depth,u,v,ocean_time’,Particle3D API中fields的设置似乎并没有生效

particle3D = new Particle3D(viewer, {
  input: file,
  fields: {
    U: 'u',
    V: 'v',
    lon: 'x',
    lat: 'y'
  },
  colorTable,
  userInput
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.