Yes, this is the right location for modifying the projection.

One oddity I noticed with your code is that your coordinates don’t appear to be relative to your origin, and you have very large values as a result – values that are large enough to result in noticeable floating point inaccuracies during a quick test I did. I would intuitively modify your calcPos implementation as such:

    double x = mercator.getEasting() - originX;
    double y = mercator.getNorthing() - originY;

Of course, that is going to shift the output coordinates in the OBJ by a fixed amount, not sure if that’s a problem for your use case? It could be solved by modifying the resulting .obj file, adding the origin’s coordinates back onto the coords. (You can do that outside OSM2World, or hack it into the ObjTarget.)

That being said, missing terrain chunks are unfortunately a known bug even with unaltered projection code at the moment. Until that is fixed, you sadly aren’t going to get rid of exceptions related to SurfaceArea(w0) without disabling generation of empty terrain entirely. :frowning: