Issues 3DTileStying Point Cloud

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

I have tried representing regionally gridded precipitation data as a PointCloud in .pnts format both coloring it using RGB values and by using a Batch Table with no RGB and then trying to style off the Batch Table property.

The points display, but they do not accept any of the 3DTileStyle modifiers that I apply to them.

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

For version with RGB values and no Batch Table (IMERGtest.pnts):

viewer = new Cesium.Viewer(‘cesiumContainer’,{
geocoder: false,
homeButton: false,
baseLayerPicker: false,
animation: false,
sceneModePicker: false,
imageryProvider: new Cesium.ArcGisMapServerImageryProvider({
url: “https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/”,
enablePickFeatures: false
})
});

tilesets = ;
for (var q=0;q<144;q++) {
tilesets.push(viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: ‘…/include/imergPnts/’+q+’/’,
shadows: Cesium.ShadowMode.DISABLED,
style: new Cesium.Cesium3DTileStyle({
/color: {
conditions: [
[’{precRate} >= 20','color("red")'], ['{precRate} >= 10’,‘color(“green”)’],
[‘true’,‘color(“blue”)’]
]
},
/
pointSize: 1.0,
scaleByDistance: ‘vec4(1e5,5.0,1.2e7,0.3)’
})
})));
}

For version without RGB values and with BatchTable (IMERGtestBT.pnts), just remove the comments surrounding the “color” field.

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

Testing out using Point Clouds to visualize gridded data more efficiently than PointPrimitives

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

Cesium 1.42; Centos 6; Firefox 52.6.0

IMERGtest.pnts (829 KB)

IMERGtestBR.pnts (884 KB)

tileset.json (185 Bytes)

I should also mention (since I discovered it as I was exploring using Point Clouds) that if you have a globe-scale Point Cloud, points on the opposite side of the globe appear in the scene along with ones on this side of the globe. They aren’t rendered invisible by the globe tiles. This is likely a super-niche use case, but one you should be aware of.

Sorry for the slow reply.

I tried it out and it seems to be working for me. I edited tileset.json to reference IMERGtestBR.pnts and then loaded it in Sandcastle with this code:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

viewer.scene.globe.depthTestAgainstTerrain = true;

var tileset = new Cesium.Cesium3DTileset({

url: '../../SampleData/test/IMERG'

});

viewer.scene.primitives.add(tileset);

tileset.style = new Cesium.Cesium3DTileStyle({

color: {

  conditions: [

      ['${precRate} >= 20','color("red")'],

      ['${precRate} >= 1','color("green")'],

      ['true','color("blue")']

  ]

},

pointSize: 1.0,

//scaleByDistance: ‘vec4(1e5,5.0,1.2e7,0.3)’

});

``

I commented out scaleByDistance because that property is only supported for vector tiles right now, but leaving it in didn’t cause any problems. I also changed >= 10 to >= 1 just so it was easier to see the green points.

Finally I added

viewer.scene.globe.depthTestAgainstTerrain = true;

``

so that points on the opposite side of the globe are obscured.

Let me know if that code works for you.

Sean,

Thanks - not sure exactly where I was going wrong, but tried to make my code look as close to yours as possible, and had success! Removed disabling ShadowMode; added style AFTER tileset added to primitives; added depthTestAgainstTerrain.

Would still love to have scaleByDistance, but understand there’s a lot of testing involved, and as I stated previously, my use case is probably on the edge of what you envisioned being done with Point Clouds.

Awesome!

If you want scale by distance functionality, you could try to code it into the pointSize style. I haven’t tried doing that myself so I don’t know what to recommend, but it could be worth a shot.