How to overlay/drape a raster layer over 3d building tiles

Hi , I have a solar potential raster of the buildings in an particular area of 0.5 m resolution which have the solar potential values pixel wise on the buildings and rest of the area with no data. I want to overlay that raster over the buildings such that the building roof tops will show the solar potential of the buildings and the remaining part will be transparent. Is it possible to do that?.

You can clamp your raster images on 3D Tiles by adding it to a polygon, see the “textured material” in this example:

https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Classification%20Types.html

So if your images had an alpha channel where everything outside of the buildings was transparent, that could be one way to do it.

Is this for an application that will be public? It sounds like it’d be a cool thing to showcase on the Cesium blog!

Thanks a lot. It worked for me. But i am facing one problem. I have stored the solar potential details building wise with the 3d building tiles. i want to get the details when i click those building tiles using pickedFeature.getproperty(). Before overlaying i am able to get those details. After overlaying the raster over the tiles, i am not able to get those details as it is taking click feature as overlayed raster feature not the tile feature. How to exclude the overlayed raster from the click event. or any other ideas.

Sir, any solution to my problem?.

You can try using drillPick instead of pick, which will give you everything under the mouse, and then you can filter out the raster objects out of that list.

Thanks a lot, the issue with scene.pick is resolved. I have the colorized raster with high resolution in .tif format. When i am trying to drape using classification, I am getting the output as like while color raster draped over buildings as attached, but after converting to jpeg or png i am able to see the colorized raster on the buildings. But the problem is visual quality is very poor as it is getting compressed during conversion from .tif to jpeg.

only jpg or png can also be used as polygon materials. how to load tif format file . i tried to load the image from cesium but no use.

Try converting it to a PNG image. That should give you lossless compression so it should look exactly like the original.