Cesium.Ion.defaultAccessToken = 'YOUR TOKEN';
var worldTerrain = Cesium.createWorldTerrain({
requestWaterMask: true,
requestVertexNormals: true
});
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: worldTerrain
});
var rectangleInstance = new Cesium.GeometryInstance({
geometry: new Cesium.RectangleGeometry({
rectangle: Cesium.Rectangle.fromDegrees(-179, -89, 180, 89),
vertexFormat: Cesium.VertexFormat.ALL,
}),
id: 'rectangle',
});
viewer.scene.primitives.add(new Cesium.GroundPrimitive({
geometryInstances: rectangleInstance,
// classificationType: ClassificationType.TERRAIN,
appearance: new Cesium.EllipsoidSurfaceAppearance({
aboveGround: true,
fragmentShaderSource: `
void main() {
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0); // <= look at here
}
`
}),
}));
Result:
the color should be yellow, but it isn’t.
When I modify GroundPrimitive
to Primitive
, it looks good.
How to resolve this problem? Thanks in advanced