Shaders and selected primitives in PostProcessStage

1. A concise explanation of the problem you’re experiencing.

Hello, I have edges shader (a little tweaked, but this is more a general question and probably applies to cesium edges shader as well). With that edges shader, I want it is specifically applied only to some specific primitives and tilesets. I found that there was a bug stating that this is not possible and needs some more work on Cesium side (sorry, I cannot find the reference at the moment). So, this is ok for now, so I was thinking to apply the shader just to models and primitives (polygons in my case). I tried to apply it in the selected array in PostProcessStage, but it worked only for models, however not for the polygon. This is illustrated in the sandcastle. Can anyone more knowledgeable have a look at the sample and tell me if there is anything wrong, please? Or if I’m doing something principally wrong?

Maybe other idea could be that I can write my own implementation of the shader, but not to use czm_selected function, but something else. This would be also interesting to explore, however I don’t know where to start and if this makes sense.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I’m building a simple modelling tools into our system. However, I need to remove edges from some shapes.

4. The Cesium version you’re using, your operating system and browser.

1.63, mac, Chrome

Per-feature post-processing doesn’t work for entities at the moment, see this GitHub issue which links to a discussion about why that is and some possible ideas for how to implement it: https://github.com/AnalyticalGraphicsInc/cesium/issues/6705

Hello Omar, I read discussion in the link, thank you. However, I was referring to a polygon primitive. So, as it was suggested there, I extended Primitive with pickIds, and the shader suddenly started working.

Cesium.defineProperties(Cesium.Primitive.prototype, {
pickIds: {
get: function() {
return this._pickIds;
}
}
});

``

However, this is a little hack, I think. So I will fill a bug for inclusion to Cesium if there is no side effect of this.

However, I have another question - is here any way how to recognize in the shader if the object is tileset (in general)? And also what type of tileset it is? I’m asking because we have some pointclouds and some shaders are crashing on pointclouds (I think it is this edge shader), so we have to turn off the whole shader.

Martin

Dne středa 4. prosince 2019 15:13:05 UTC+1 Omar Shehata napsal(a):