I’m trying to load some geojson by use primitive. cause I want to render it by custom, i use
let instance = new Cesium.GeometryInstance({
geometry: new Cesium.PolygonGeometry({
polygonHierarchy: feature.polygon.hierarchy,
extrudedHeight: 100 * Math.random(),
}),
});
new Cesium.Primitive({
geometryInstances: [instance],
appearance: new Cesium.Appearance({
translucent: false,
renderState: {
blending: Cesium.BlendingState.PRE_MULITIPLIED_ALPHA_BLEND,
depthTest: {
enabled: true,
},
depthMask: true,
},
vertexShaderSource: `
attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec3 normal;
attribute vec2 st;
attribute float batchId;
varying vec4 v_positionEC;
varying vec3 vv;
varying vec2 v_st;
void main()
{
vec4 p = czm_computePosition();
vec4 eyePosition = czm_modelViewRelativeToEye * p;
v_positionEC = czm_inverseModelView * eyePosition;
vv = normal;
v_st = st;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`,
fragmentShaderSource: `
varying vec3 vv;
varying vec2 v_st;
void main() {
gl_FragColor = vec4(0., v_st.y, 1., 1.0);
}
`,
}),
})
then i found that:
i change
v_st.y
to
v_st.x
it became
but what i want, is color gradual change(from bottom to top) like:
Is there any way to achieve it?