In the development of planar GIS, sometimes a satellite image is attached to the map



As a two-dimensional creature, there is no concept of height, and the satellite cloud image blends into the map below.

However, in THREE-DIMENSIONAL GIS, if a satellite cloud image is attached tightly to the ground, as if sticking plaster, it can not reflect the advantages of three-dimensional.



Of course, the clouds should be less than ten thousand meters above the ground, and you can’t see any vertical height. But to see the effect, exaggerate a bit, with satellite clouds floating in space above Earth, forming a Dyson sphere. That’s the way it goes. Chu bang field, ding fried bridge, hole fun.



How do we do that?

The idea is as follows: 1. Construct a rectangular Primitive (Cesium.Primitive), which is the four corners of the satellite cloud image. 300 miles above the ground. Are you afraid? 3. Add the pixel to the map

The code is as follows:

var rectangle = viewer.scene.primitives.add(
	new Cesium.Primitive({
		geometryInstances: new Cesium.GeometryInstance({
			geometry: new Cesium.RectangleGeometry({
			  rectangle: Cesium.Rectangle.fromDegrees(w,s,e,n),
			  //vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
			  height: 300000})}),appearance: new Cesium.EllipsoidSurfaceAppearance({
			aboveGround: true,})})); rectangle.appearance.material =new Cesium.Material({
	fabric: {
	    type: "Image".uniforms: {
			image: "./images/cloud.png".alpha:0.7 / / transparency
	    },
	    components : {
		  diffuse : 'texture2D(image, fract(repeat * materialInput.st)).rgb'.alpha : 'texture2D(image, fract(repeat * materialInput.st)).a * alpha'// Set transparency indispensable sentence}},translucent : true
});		
Copy the code

The principle is not complicated, the code is simple. The main thing is how to set transparency and here, it’s hard to find an example. As an example, always given, there is one, always translucent, yet as a satellite image always opaque, failing to clear the Earth beneath. I’m not sure what this component is for. When opacity is set, alpha is a long string of spells.

Keep in mind.

Reference article: sandcastle.cesium.com/?src=Materi… https://github.com/CesiumGS/cesium/issues/2484


2020.08.07

It’s even more obvious this way