Simple material question

Hello,

Is it possible to only drape a material color on the ground and not on buildings?
The polygon is a GeoJsonDataSource with "clampToGround : true "and the building is an 3D-tiles asset loaded from ion.

Hi there,

I would recommend looking into the different classification types. You should be able to classify terrain only.

Hello,

Thanks for the reply, I will take a look at it.

/ Albin

Hey again @Gabby_Getz , so I have managed to get it to work with standard materials. But when i construct my own material it does not work, any suggestions?

The only difference is this code part:
const polygon = viewer.entities.add({
polygon: {
hierarchy : new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray([coordinates]),
),

material: Cesium.Color.RED.withAlpha(0.5),
  classificationType: Cesium.ClassificationType.TERRAIN,
}})

and with my own texture:

const polygon = viewer.entities.add({
polygon: {
hierarchy : new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray([coordinates]),
),
material: new Cesium.ImageMaterialProperty({
image:‘Korsmark.jpg’,
classificationType: Cesium.ClassificationType.TERRAIN,

})}})

Here is a picture from the model:

/Albin

Hi @Albnas,

I think you have the classificationType nested in the wrong place. It should not be under material, it should be:

...
material: new Cesium.ImageMaterialProperty({
    image:‘Korsmark.jpg’ 
})
classificationType: Cesium.ClassificationType.TERRAIN
}})

Wonderful, now it works! Thank you