Hello, Recently I want to flatten Cesium3dTileSet, the general idea is to modify the positionMC in CustomShader’s vertexMain, but now the problem is the computed positionWC has low precision and the result is uneven, the code like below:
void vertexMain(VertexInput vsInput, inout czm_modelVertexOutput vsOutput) {
vec4 worldPosition = czm_model * vec4(vsInput.attributes.positionMC,1.0);
// some code aiming at filtering with worldPostion
// some code change the worldPosition
vec4 modelPosition=czm_inverseModel * worldPosition;
vsOutput.positionMC=modelPosition.xyz/modelPosition.w;
}
What do you mean by “flattening”? Are you trying to smooth out the surface of the model or something? A before, after and intended image would be helpful. Are you using any terrain model data?
Hello, the solution is to transfer the upvector in camera coordinate to the customshader as a Uniform, then in vertexMain program, use the positionEC to compute ,not the worldPosition, because worldPostion will lowdown the precision, the method to get positionEC is below:
Hello, you could try to add polygon coords in eye coordinates to this vertexMain shaders, then to compute whether or not the frag is in the coords polygon.