a few beginner questions

Hello
My name is Alex Siro and i`m currently working on my first project using Cesium
I’ve managed to overcome the initial problems, but now I’ve come across some other ones, which can be seen in the posted screenshot

  1. The textures don’t follow the same orientation as the polygons. Is there a way to specify vertex - texel mapping?
  2. The polygons exhibit jitter (dimensions of the polygons are: length: 4 meters, width: 2 meters). Is there a way to avoid jitter when using CZML to define the vertices?
  3. There seems to be a great difference in performance (for DynamicObject between using points and polygons for graphical representation). With points, I’ve managed to render about 25000 objects without any major performance penalty. Polygons (textured or solid color) bring down the frame rate considerably.
  4. Can I instruct the GPU to compute the absolute vertex positions automatically? The method would be to pass the object’s position, its orientation and the relative coordinates of the polygon, and then to have the translation / rotation executed on the GPU. Is this possible / faster than to pass the precalculated absolute vertex positions? For example, it now takes about 500ms to complete a visualizers.update call for a collection of 1800 objects (each with 5 vertices)
  5. Is there a way to remove the objects from a dynamic collection automatically if they don’t have a position specified for the current time? In my case, I fetch data from the server only for visible objects, and I want to keep my DynamicObjectCollection as slim as possible each iteration (objects can move in and out of the viewport at any time). For now, i’ve tried to use a 4-coordinate position (including time) for each object, but this doesn’t seem to work. Cesium seems to ignore the time property when executing visualisers.update(currentTime). Neither are objects (which don’t have a position for currentTime) removed from the collection, nor are they hidden from view. I’ve ended up calling dynamicObjectCollection.clear each iteration, but I would like to keep visible objects in the collection between successive iterations and update them, in order to get a smooth animation (using position interpolation).

Below is my animation javascript code for an iteration:

CZMLData = new Array();
var startEpoch = ‘2012-01-01’;

var pos = {interpolationAlgorithm:“LAGRANGE”,
interpolationDegree:1,//what does this mean?
epoch: startEpoch,
cartographicDegrees:[currentTime,
x,
y,
0]};

CZMLData.push({
id:response[0][i],
position: pos,
/point:{
color: speedColor,
//outlineColor: speedColor,
outlineWidth: 1,
pixelSize: 4
}
/
polygon: {
material: {
image: {
image: carIcons[response[3][i]]
}
}
},
vertexPositions: {
cartographicDegrees: [x+cos90vehicleWidth, y+sin90vehicleWidth, 0,
x+cos90vehicleWidth+cosvehicleLength, y+sin90vehicleWidth+sinvehicleLength, 0,
x-cos90vehicleWidth+cosvehicleLength, y-sin90vehicleWidth+sinvehicleLength, 0,
x-cos90vehicleWidth, y-sin90vehicleWidth, 0,
x+cos90vehicleWidth, y+sin90vehicleWidth, 0]
}
}
);
dynamicObjectCollection.clear();
Cesium.processCzml(CZMLData,dynamicObjectCollection);
visualizers.update(currentDate); // this takes 500 ms for 1800 polygon objects, slower than I expected. Is it OK? (I’m using the latest version of Chrome)

Thank you

Hi Alex,

I can answer Questions 1-4.

Long-story short, I suggest writing custom rendering code based on the existing Polygon implementation or even the simple custom rendering example in Sandcastle. You’ll get the best performance and flexible for your use case.

  1. The textures don’t follow the same orientation as the polygons. Is there a way to specify vertex - texel mapping?

Currently, there is not a way to adjust the texture coordinates computed by the Polygon or provide a texture matrix. We want to extend the material system to something similar to surface shaders, which will allow better control over inputs like texture coordinates to the material system, but it will be a while before we get there as this needs to be carefully designed. Adding a texture matrix to the Image material may be reasonable in the meantime.

  1. The polygons exhibit jitter (dimensions of the polygons are: length: 4 meters, width: 2 meters). Is there a way to avoid jitter when using CZML to define the vertices?

We fixed jitter in the globe itself, billboards, labels, and polylines, but have not done polygons yet. It will be easy; we will use GPU RTE like the polyline. We welcome this contribution if you are up for it; those of us that typically work on this code have our hands full with NORAD Tracks Santa at the moment. I created Issue 358.

  1. There seems to be a great difference in performance (for DynamicObject between using points and polygons for graphical representation). With points, I’ve managed to render about 25000 objects without any major performance penalty. Polygons (textured or solid color) bring down the frame rate considerably.

The billboard collection that is used to render points has lots of optimizations that batch up all the billboards and only modify parts of the vertex data that need to be. Currently, polygons are rendered individually so they will render much slower than billboards. We plan to do batching for polygons (and other objects like ellipsoids, for example), but this will require pretty significant design work and is at least a few months out. We welcome a contribution here too, but you might also want to write custom code optimized for your case - it is certainty less work than the general feature.

  1. Can I instruct the GPU to compute the absolute vertex positions automatically? The method would be to pass the object’s position, its orientation and the relative coordinates of the polygon, and then to have the translation / rotation executed on the GPU. Is this possible / faster than to pass the precalculated absolute vertex positions? For example, it now takes about 500ms to complete a visualizers.update call for a collection of 1800 objects (each with 5 vertices)

Yes, you could do this in a vertex shader if you write custom rendering code, but be careful with the 32-bit floating point precision. You will have to emulate double precision. However, chances are if you implementing batching, you will not need this optimization, or at least this optimization will have less impact. Batching may be 10x, and this might get you 2x (I just made those numbers up but you get the idea). You could also do this server-side, and just send a typed array over the wire ready to be rendered.

Regards,

Patrick

Thanks for your guidance, Patrick! I’ll try to implement custom solutions as you suggested.
Does anyone know the answer to the last question?

Thanks

luni, 3 decembrie 2012, 03:23:32 UTC+2, Patrick Cozzi a scris:

Also checkout the Renderer section in the Architecture Guide if you haven’t already. It is slightly out-of-date now that we started on the Data-Driven Renderer. The big difference is we do not have to explicitly make draw calls; instead, we return draw commands, which allows the renderer to cull, sort by frustum, etc. The code examples I pointed you to will make this clear.

Patrick

Hello Patrick

Unfortunately the solutions you suggested might take some time, so I decided to use a combination of polylines instead.

It seems that the width properties of the polyline don’t work. Are they supposed to work? I looked at the objects created according to the czml data and the width values are in their place. Aren’t the properties passed for rendering?

Thanks

miercuri, 5 decembrie 2012, 03:30:49 UTC+2, Patrick Cozzi a scris:

Hi Alex,

Polyline width doesn’t work in Windows when ANGLE is on (which is the default in Chrome and Firefox) because ANGLE doesn’t support polyline width greater than one. This is not an issue on Linux and Mac though. We plan to implement polyline width in a vertex shader to bypass the problem, but that is a little ways out.

Regards,

Patrick

Hi Alex,

Although I still think custom rendering code is the best approach for you, we just made two changes you will be interested in (pull these from github; they will be in b13 in February):

  • Fixed polygon jitter - #461
  • Added a rotation angle for textures on polygons - #463

Regards,

Patrick