In this example, using CustomShader
to convert model coordinates to world coordinates, and then converting world coordinates to model coordinates, but the coordinates lose precision.
const modelShader = new Cesium.CustomShader({
vertexShaderText: `
void vertexMain(VertexInput vsInput, inout czm_modelVertexOutput vsOutput)
{
vec4 positionWC = czm_model * vec4(vsInput.attributes.positionMC, 1.0);
vsOutput.positionMC = (czm_inverseModel * positionWC).xyz;
}
`,
});
I want to convert the model coordinates to world coordinates for some operations, and then convert them back. Is there any good way?