-
Notifications
You must be signed in to change notification settings - Fork 215
[Research] Normalize mesh with a reference point as origin #30
Comments
@LexSong |
That's matrix multiplication operator. It basically apply rotation matrix
on vertices to align horizon to the Y/Z plane.
|
Ah thank you, this require python3.5 it seems (Debian has 3.4 only by default that's why) |
You could use `numpy.dot(a, b)` to replace `a @ b`.
|
What units does the vertex position currently represent? I want to translate them to latlong space, and I want to remove the rotation. I basically want to transform the mesh into webmercator space. Happy to do the work, just need some info to start with. |
the vertices are actually postionned correctly in a 3D perfect sphere based on lat/lon, you can remove entirely the matrices operations in the initial dump_obj script to get the vertices based on a 0,0 reference point for each tile without rotation if that's what you want |
It's difficult to convert to Mercator projection correctly. First, Mercator projection have different scale based on latitudes. Therefore you must also scale the height based on each vertex's location. Second, the heights in Google Earth is not correct. It doesn't match the ellipsoid or the sea level. We could calculate each vertex's distance to the earth center, but we're not sure how to scale the distance to make the shape correct. |
@LexSong could you please describe step by step how to work with the scripts? My goal here is to have a bounding box high res stitched mesh, e.g. for the use in Blender. To download a large area I understood
On a single octant dump I would now run UPDATE: nevermind - I have not used your tool since 2019 and I'm happy to see the files are nowadays dumped into a single OBJ and correctly stitched - AWESOME! |
I've adapted this repo for that. https://github.com/HakkaTjakka/MinecraftWorldEditor/tree/master/EARTH |
In my testing fork, I add two scripts to handle mesh normalization.
In
normalize_obj.py
, the script normalize the mesh with a reference XYZ point instead of the mesh center. Therefore we could normalize several meshes with the same origin and keep their relative position. The script also rotate the mesh with latitude and longitude of the reference point, to align north/south and east/west axes.To find the reference point, in another script
find_obj_mid_point.py
, I compute the mesh midpoint by convert mesh vertices to latitude/longitude/altitude and calculate the midpoint's location. The trick here is that we don't have to calculate the midpoint of high resolution mesh. We should use a low resolution mesh instead to avoid unnecessary computation.The text was updated successfully, but these errors were encountered: