3dtiles style gradient change

1. A concise explanation of the problem you’re experiencing.

I want to set 3dfiles to change color gradually according to the height ,jus like this

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

I saw a piece of shader code , but i do not know how to calculation the v_elevationPos. is there any way to calculation it ?

var fsBody = `

float vtxf_a11 = fract(czm_frameNumber / 120.0) * 3.14159265 * 2.0;

float vtxf_a12 = v_elevationPos.z / 60.0 + sin(vtxf_a11) * 0.1;

gl_FragColor *= vec4(vtxf_a12, vtxf_a12, vtxf_a12, 1.0);


3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I want to set the 3dtiles colored gradually.

4. The Cesium version you’re using, your operating system and browser.

cesium version:1.58

operating system:windows 10

browser:chrome 78.0.3904.70

Can you post a link to where you found that code?

You may be able to use the absolute position as a proxy for elevation. There’s some discussion on this and a code example in this thread: https://groups.google.com/d/msg/cesium-dev/zfshDIFWDg0/U51APKSoAQAJ