Wall with varying colours associated to different position in positions property. Flickering / Performance drop


We are currently building a wall entity that gets built dynamically. We want each 2 positions to have a different colour with a StripeMaterial, and since we are only allowed to use one colour per entity, we have divided each 2 positions into a separate wall entity. It looks like in the following image:

However, flickering occurs once the wall becomes long enough and start updating the wall’s positions. Using a callback property to return the new positions for each entity fixes it, but performance greatly diminishes the longer it gets.

Is their any possible solution to this problem?

Thank you.

There are many possible solutions for this problem. One could try to find a solution for the flickering. Or try to improve the performance for many walls. But my gut feeling is that using the StripeMaterial might not be the best approach, and splitting the wall into multiple wall entities may just have been a workaround that caused further problems.

It could make sense to search for a different solution on a higher level. If the goal is only to have a wall with varying colors, then there could be multiple solutions that do not cause the problems that you descibed. It’s hard to point out the “best” solution without further detail knowledge about the goals. The solution could be a custom Material, or maybe even a CustomShader. But a comparatively simple solution that could already be a good trade-off in terms of effort and performance could be to use an image material, … with the appropriate image.

The result could look like this:

Here is an example that creates such an image material from a given sequence of colors:

From your description, it sounds like you want to make sure that the number of colors is (numberOfWallPoints+1), so that each wall segment interpolates between two colors. (You might want to check for off-by-one-errors in the given Sandcastle - I didn’t test it that extensively…)

The approach could be generalized, though. Essentially, it allows defining arbitrary “color lookups”. For example, one could just define the look up to be a sine curve that walks through a given set of colors - like cyan, magenta and yellow in the upper wall here:

Cesium ColorWall Extended

This may not be necessary in your case, but … here’s the sandcastle anyhow: