Self made 3D tiles terrain, precision problem at edges problem

To emphasize my disclaimer:

There are several building blocks and processing steps coming together here: The source data. The conversion. The representation within the glTF. The rendering engine. And at each point, precision might be lost in one way or another. So it might be necessary to iterate on some of these points in order to find a suitable solution.


I’m not sure whether I fully understood all details of what you have been describing in the last posts. But iff I understood this correctly, then you are doing certain computations (for aligning the vertex positions) within Blender. (I’m not a Blender expert - is this some sort of “script” that can be run in Blender itself? Or some sort of ~“Python-based ‘Plugin’ for Blender” that you created just for this purpose?)

Looking at the node.translation of [ 4200249.74042291,2793613.93061088, 3880785.3615384 ] in the JSON that you posted, it might very well be that this large translation causes trouble here. (Maybe some of this could even be caused for double when something like a cancellation is happening somewhere - some guesses are involved here…)

Specifically, you mentioned

… the process is simply summation of mesh.translation(Center) + local vertex value (double + float) . (or, is it?)

I don’t know for sure. But it might be that Blender is doing some computation or storage here in single-precision float.

Even at the risk that this appears to be a bit of trial-and-error (with the goal of not really avoiding but just minimizing the error…):

You could try to not store the node.translation in the glTF at all. Instead, you could apply this translation as part of the tile.transform within the tileset JSON.

This may have two advantages:

  • The resulting glTF could be in its canonical form: At the origin, with y-up. (I tried to illustrate this advantage in an otherwise unrelated thread
  • More important here: All the computations that you are doing there do no longer involve these “huge” numbers. They can all happen in this “local, small glTF”. (And the glTF is only moved to the right position eventually, with the 3D Tiles transform)