Ortho4XP icon indicating copy to clipboard operation
Ortho4XP copied to clipboard

Flat mesh

Open mmaechtel opened this issue 11 months ago • 39 comments

Hi,

I only get totally flat meshes out of 1.4. I'm sure I changed something, since it worked about 2 weeks ago, but I've run out of ideas what the cause could be. Maybe someone could help me out of my 'flat world' :) Tnx Mike

Batch build launched for a number of 1 tiles. Dealing with tile 1 / 1 : +47+008

Step 1 : Building vector data for tile +47+008 :

-> Dealing with airports * Recycling OSM data from .\OSM_data+40+000+47+008+47+008_airports.osm.bz2 EDSI Segelflugplatz Binningen 1 runway , lat= 47.80, lon= 8.72 EDSL Flugplatz Blumberg 2 runways, lat= 47.84, lon= 8.56 EDSN Neuhausen ob Eck Airfield 1 runway , lat= 47.98, lon= 8.90 EDSR Flugplatz Stahringen-Wahlwies 1 runway , lat= 47.80, lon= 8.98 EDTD Verkehrslandeplatz Donaueschingen-Villingen 2 runways, lat= 47.97, lon= 8.52 LSMD Militärflugplatz Dübendorf 2 runways, lat= 47.40, lon= 8.64 LSME Militärflugplatz Emmen 1 runway , lat= 47.09, lon= 8.30 LSPF Sportflugplatz Schmerlat 1 runway , lat= 47.69, lon= 8.53 LSPH Flugplatz Hegmatten 1 runway , lat= 47.51, lon= 8.77 LSPN Flugplatz Triengen 1 runway , lat= 47.23, lon= 8.08 LSPV Flugplatz Wangen-Lachen 1 runway , lat= 47.20, lon= 8.87 LSZF Flugplatz Birrfeld 2 runways, lat= 47.44, lon= 8.23 LSZH Zürich Airport 4 runways, lat= 47.46, lon= 8.56 LSZK Flugplatz Speck-Fehraltorf 1 runway , lat= 47.38, lon= 8.76 LSZN Hausen am Albis Airfield 2 runways, lat= 47.24, lon= 8.52 LSZO Flugplatz Beromünster 2 runways, lat= 47.19, lon= 8.20 LSZT Flugplatz Lommis 1 runway , lat= 47.52, lon= 9.00 LSZU Flugplatz Buttwil 1 runway , lat= 47.26, lon= 8.30 **** Segelfluggelände Bohlhof 1 runway , lat= 47.65, lon= 8.38 **** Segelflugplatz Hilzingen 1 runway , lat= 47.76, lon= 8.77 **** Segelflugplatz Reiselfingen 1 runway , lat= 47.85, lon= 8.37 **** **** 1 runway , lat= 47.19, lon= 8.09 **** **** 1 runway , lat= 47.56, lon= 8.20 **** **** 1 runway , lat= 47.20, lon= 8.96 Loading elevation data and smoothing it over airports. Downloading .\Elevation_data+40+000\N47E008.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N47E007.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N47E009.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N46E008.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N46E007.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N46E009.hgt from Viewfinderpanoramas (J. de Ferranti). * Min altitude: 0.0 , Max altitude: 1147.0 , Mean: 7.854457 Patching LSZH.patch.osm Auto-patched 29 runways and 173 pieces of taxiway. Flattened 76 helipads. Number of edges at this point: 22635 -> Dealing with roads * Recycling OSM data from .\OSM_data+40+000+47+008+47+008_big_roads.osm.bz2 * Checking which large roads need levelling. * Buffering banked road network as multipolygon. Encoding it. Number of edges at this point: 47080 -> Dealing with coastline * Recycling OSM data from .\OSM_data+40+000+47+008+47+008_coastline.osm.bz2 Number of edges at this point: 47080 -> Dealing with inland water * Recycling OSM data from .\OSM_data+40+000+47+008+47+008_water.osm.bz2 * Building water multipolygon. * Bodensee will be masked like the sea due to its large area of 532 km^2. Cleaning it. Encoding it. Separate treatment for larger pieces requiring masks. Encoding them. Number of edges at this point: 108532 -> Inserting edges related to the orthophotos grid -> Inserting additional boundary edges for gluing -> Transcription to the files C:/X-Plane Enhancement/1.4/zOrtho-Experiments\zOrtho4XP_+47+008\Data+47+008.poly and .node

Final number of constrained edges : 152483

Completed in 46.20sec.


Step 2 : Building mesh for tile +47+008 :

-> Modifying curv_tol weight map according to runway locations. -> Modifying curv_tol weight map according to coastline location. * Recycling OSM data from .\OSM_data+40+000+47+008+47+008_coastline.osm.bz2 -> Start of the mesh algorithm Triangle4XP. Loading altitudes from DEM file.

Loading curv_tol geographic weights.

Computing curvatures from altitudes.

Constructing Delaunay triangulation by divide-and-conquer method.

Recovering segments in Delaunay triangulation.

Spreading regional attributes.

Adding Steiner points to enforce quality.

Looking for bad triangles.

Computing altitude and normal maps.

Node file C:/X-Plane Enhancement/1.4/zOrtho-Experiments\zOrtho4XP_+47+008\Data+47+008.1.node written to disk.

Tri file C:/X-Plane Enhancement/1.4/zOrtho-Experiments\zOrtho4XP_+47+008\Data+47+008.1.ele written to disk.

Statistics:

Input vertices: 128548

Input segments: 152483

Input holes: 0

Mesh vertices: 169,248

               -----------------

Mesh triangles: ---> 329,863

               -----------------

Mesh edges: 499110

Mesh exterior boundary edges: 8631

Mesh interior boundary edges: 157230

Mesh subsegments (constrained edges): 165861

-> Loading of the mesh computed by Triangle4XP. -> Post processing of altitudes according to vector data Smoothing inland water. Smoothing of sea water. Treatment of airports, roads and patches. -> Writing output nodes file. -> Writing final mesh to the file C:/X-Plane Enhancement/1.4/zOrtho-Experiments\zOrtho4XP_+47+008\Data+47+008.mesh

Completed in 3.72sec.


Step 2.5 : Building masks for tile +47+008 :

-> Deleting existing masks -> Reading mesh data -> Deleting existing masks -> Reading mesh data

  • C:/X-Plane Enhancement/1.4/zOrtho-Experiments\zOrtho4XP_+47+008\Data+47+008.mesh -> Construction of the masks Created 11424_17184.png Created 11408_17200.png Created 11408_17184.png Created 11424_17200.png Created 11440_17184.png Created 11440_17200.png

Completed in 4.57sec.


Step 3 : Building DSF/Imagery for tile +47+008 :

-> Initializing providers with potential data on this tile. -> Checking airport locations for upgraded zoomlevel. -> Reading mesh file -> Adapting water triangles to XP12 requirements -> Computing bathymetry depth ratio bounds based on distance masks -> Computing point pools and texture requirements -> Encoding of the DSF file Final nbr of nodes: 393846 Extracting some rasters from X-Plane's Global Scenery DSF file encoded, total size is : 16789809 bytes (16.0M) *Activating DSF file.

Completed in 16.99sec.


Step 4 : Extracting overlay for tile +47+008 :

-> Making a copy of the original overlay DSF in tmp dir -> The original DSF is a 7z archive, uncompressing... -> Converting the copy to text format Converting .\tmp+47+008.dsf from DSF to text as .\tmp+47+008_tmp_dsf.txt

 File .\tmp\+47+008.dsf had 167 ter, 0 obj, 187 pol, 12 net.

 Converted .\tmp\+47+008.dsf to .\tmp\+47+008_tmp_dsf.txt

-> Selecting overlays for copy/paste -> Converting back the text DSF to binary format Converting .\tmp+47+008_tmp_dsf_without_mesh.txt from text to DSF as .\tmp+47+008_tmp_dsf_without_mesh.dsf

 Scanning for dimension properties...

 Got dimension properties, establishing file writer...

 Got entire file, processing and creating DSF.

 Converted .\tmp\+47+008_tmp_dsf_without_mesh.txt to .\tmp\+47+008_tmp_dsf_without_mesh.dsf

-> Coping the final overlay DSF in .\yOrtho4XP_Overlays\Earth nav data+40+000

Completed in 9.26sec.


Batch process completed in 1m20sec


apt_smoothing_pix=8 road_level=1 road_banking_limit=0.5 lane_width=4.0 max_levelled_segs=200000 water_simplification=0.0 min_area=0.05 max_area=200.0 clean_bad_geometries=True mesh_zl=19 curvature_tol=2.0 apt_curv_tol=0.5 apt_curv_ext=0.5 coast_curv_tol=1.0 coast_curv_ext=0.5 limit_tris=3.0 min_angle=10.0 sea_smoothing_mode=zero water_smoothing=10 iterate=0 mask_zl=15 masks_width=100 masking_mode=sand use_masks_for_inland=False imprint_masks_to_dds=False distance_masks_too=False masks_use_DEM_too=False masks_custom_extent= cover_airports_with_highres=True cover_extent=1.0 cover_zl=18 water_tech=XP12 ratio_bathy=1.0 ratio_water=1.0 overlay_lod=25000.0 sea_texture_blur=0.0 normal_map_strength=1.0 terrain_casts_shadows=True use_decal_on_terrain=True custom_dem= fill_nodata=True default_website=BI default_zl=18 zone_list=[]

mmaechtel avatar Mar 10 '24 14:03 mmaechtel

Please zip and attach C:/X-Plane Enhancement/1.4/zOrtho-Experiments\zOrtho4XP_+47+008\Data+47+008.mesh

d41k4n avatar Mar 10 '24 14:03 d41k4n

Does it work with OrthoXP 1.3?

d41k4n avatar Mar 10 '24 17:03 d41k4n

Yes, with 1.3 no problem at all

mmaechtel avatar Mar 10 '24 18:03 mmaechtel

When i use a custom_dem it's also working but not with the default 'custom_dem' (e.g. empty) settings

mmaechtel avatar Mar 10 '24 18:03 mmaechtel

I would suggest to delete the tmp folder and copy the Elevation_data folder of your 1.30 installation over to 1.40 (overwriting existing files and folders).

d41k4n avatar Mar 10 '24 19:03 d41k4n

ok, will try it. Many thanks 👍

mmaechtel avatar Mar 11 '24 06:03 mmaechtel

Same error here. But also with a fresh 1.3. I have no 1v3 with "old" height data to check with.

Update (same effect for 1.3 and 1.4): Seems like someting in the naming logic of viewfinderpanoramas changed. App is stating to download: Downloading .\Elevation_data+40+000\N47E008.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N47E007.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N47E009.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N46E008.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N46E007.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N46E009.hgt from Viewfinderpanoramas (J. de Ferranti). Downloading .\Elevation_data+40+000\N48E008.hgt from Viewfinderpanoramas (J. de Ferranti).

but the downloaded elevation data directory does not contain file N47E008.hgt.

Also, if I understood the code correctly, for +47+008 the download should request the 1° version. But the filesize is 2.8MByte and not 25MByte - so it seems to be the 3° version.

Ricky1975 avatar Mar 11 '24 14:03 Ricky1975

IMO the cause is similar to what I wrote in https://github.com/oscarpilote/Ortho4XP/issues/228#issuecomment-2000147639. Not much you can do apart from selecting a different DEM source or manually downloading the lower res 3" DEM from https://viewfinderpanoramas.org/dem3/L32.zip and extracting the missing .hgt's to the appropriate subfolder(s) in Elevation_data.

d41k4n avatar Mar 15 '24 18:03 d41k4n

However, for Europe in particular I highly recommend manually downloading and installing the much superior LiDAR DTMs provided by Sonny (and consider making a donation while at it).

d41k4n avatar Mar 15 '24 18:03 d41k4n

Now works great again with Lidar DTMs from Sonny. Many thanks for this great link to more precise data :)

mmaechtel avatar Mar 16 '24 00:03 mmaechtel

See comment: https://github.com/oscarpilote/Ortho4XP/issues/228#issuecomment-2002318083

w8sl avatar Mar 17 '24 05:03 w8sl

Following the install guide for MacOS I also have flat terrain as a result.

I found the following error in the logs, but the named config field is not available in the config window:

ERROR: file  Earth nav data/+40+000/+45+007.dsf absent.
Recall that the overlay source directory needs to be set  in the config window first.

The elevation data seems to be downloaded correctly.

Bildschirmfoto 2024-03-22 um 10 34 06

Any idea how to solve this issue?

scriptPilot avatar Mar 22 '24 09:03 scriptPilot

The error message is unrelated to the topic discussed here and possible workarounds were already mentioned earlier.

d41k4n avatar Mar 22 '24 17:03 d41k4n

When i use a custom_dem it's also working but not with the default 'custom_dem' (e.g. empty) settings

With Lidar DTMs from Sonny, is it required to select for each tile a new .hgt file and start the process for a single tile only? Or it it possible to download the whole folder from Google and automatize its usage to create a bunch of tiles at once?

scriptPilot avatar Mar 22 '24 19:03 scriptPilot

The error message is unrelated to the topic discussed here and possible workarounds were already mentioned earlier.

Alright, I've created a new issue for the error message above. https://github.com/oscarpilote/Ortho4XP/issues/239

scriptPilot avatar Mar 22 '24 19:03 scriptPilot

When i use a custom_dem it's also working but not with the default 'custom_dem' (e.g. empty) settings

With Lidar DTMs from Sonny, is it required to select for each tile a new .hgt file and start the process for a single tile only? Or it it possible to download the whole folder from Google and automatize its usage to create a bunch of tiles at once?

If you copy the .hgt files into the right folder(s) under Elevation_data you can leave custom_DEM empty and create tiles in batch mode as usual.

If you need help with installing Sonny's DTM I suggest reading/posting here:

https://forums.x-plane.org/index.php?/forums/topic/165525-sonnys-lidar-digital-terrain-models-of-europe/

d41k4n avatar Mar 22 '24 19:03 d41k4n

Thanks for the quick and helpful responses, @d41k4n!

scriptPilot avatar Mar 22 '24 20:03 scriptPilot

Example for N45E007 ... the files are downloaded and read but +265 max altitude seems not reasonable for that tile. And loading the Sim results in a more or less flat tile in that area.

Loading elevation data and smoothing it over airports.
    Downloading  ./Elevation_data/+40+000/N45E007.hgt from Viewfinderpanoramas (J. de Ferranti).
    Downloading  ./Elevation_data/+40+000/N45E006.hgt from Viewfinderpanoramas (J. de Ferranti).
    Downloading  ./Elevation_data/+40+000/N45E008.hgt from Viewfinderpanoramas (J. de Ferranti).
    Downloading  ./Elevation_data/+40+000/N44E007.hgt from Viewfinderpanoramas (J. de Ferranti).
    Downloading  ./Elevation_data/+40+000/N44E006.hgt from Viewfinderpanoramas (J. de Ferranti).
    Downloading  ./Elevation_data/+40+000/N46E007.hgt from Viewfinderpanoramas (J. de Ferranti).
    Downloading  ./Elevation_data/+40+000/N46E006.hgt from Viewfinderpanoramas (J. de Ferranti).
    Downloading  ./Elevation_data/+40+000/N46E008.hgt from Viewfinderpanoramas (J. de Ferranti).
    * Min altitude: 0.0 , Max altitude: 265.33334 , Mean: 0.021674784
Bildschirmfoto 2024-03-30 um 21 47 19

Replacing the hgt file with the one from https://sonny.4lima.de/, the result is ok:

 * Min altitude: 0.0 , Max altitude: 4623.0 , Mean: 1514.325

scriptPilot avatar Mar 30 '24 20:03 scriptPilot

What I am wondering also is that the hgt files are downloaded again on each run for the same tile. Is that by design or should they be reused like OSM or satellite images?

scriptPilot avatar Mar 30 '24 20:03 scriptPilot

Elevation data from Viewfinder Panoramas can only be downloaded in chunks of 24 tiles. Direct tile downloads based on latitude and longitude are not supported anymore.

This part of code is deprecated:

if (lat, lon) in ( (44, 5), (45, 5), (46, 5), (43, 6), (44, 6), (45, 6), (46, 6), (47, 6), (43, 7), (44, 7), (45, 7), (46, 7), (47, 7), (45, 8), (46, 8), (47, 8), (45, 9), (46, 9), (47, 9), (45, 10), (46, 10), (47, 10), (45, 11), (46, 11), (47, 11), (45, 12), (46, 12), (47, 12), (46, 13), (47, 13), (46, 14), (47, 14), (46, 15), (47, 15), ): resol = 1 url = ( "http://viewfinderpanoramas.org/dem1/" + os.path.basename(FNAMES.base_file_name(lat, lon)).lower() + ".zip" )

Above tiles belong to: "L31", "L32", "L33", "K32",

The correct syntax is:

if source == "View": # Viewfinderpanorama grouping of files and resolutions is a # bit complicated...

    deferranti_nbr = 31 + lon // 6
    if deferranti_nbr < 10:
        deferranti_nbr = "0" + str(deferranti_nbr)
    else:
        deferranti_nbr = str(deferranti_nbr)
    alphabet = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    deferranti_letter = (
        alphabet[lat // 4] if lat >= 0 else alphabet[(-1 - lat) // 4]
    )
    if lat < 0:
        deferranti_letter = "S" + deferranti_letter
    if deferranti_letter + deferranti_nbr in (
            "L31",
            "L32",
            "L33",
            "K32",
            "O31",
            "P31",
            "N32",
            "O32",
            "P32",
            "Q32",
            "N33",
            "O33",
            "P33",
            "Q33",
            "R33",
            "O34",
            "P34",
            "Q34",
            "R34",
            "O35",
            "P35",
            "Q35",
            "R35",
            "P36",
            "Q36",
            "R36",
        ):
            resol = 1
    else:
            resol = 3
    url = (
            "http://viewfinderpanoramas.org/dem"
            + str(resol)
            + "/"
            + deferranti_letter
            + deferranti_nbr
            + ".zip"
        )

w8sl avatar Jun 28 '24 16:06 w8sl

@w8sl Appreciate the feedback.

It would be helpful if you could create a pull-request that addresses this issue instead of pasting code in comments.

d41k4n avatar Jun 28 '24 17:06 d41k4n

@d41k4n Appreciate your feedback as well! Tried my best. Could not resist to update requirements

w8sl avatar Jun 28 '24 18:06 w8sl

@w8sl Short question, so I tried to make the tile +47+01, however, like mentioned above, it does not download the .hgt files. I then tried to download the Viewfinderpanoramas manually, entered them, no success. The mesh was flat. I also used Sonny's files, they did indeed make the mesh not flat, HOWEVER: -The water was not 3d and there was also a very low-res overlay on the water, even though I hadn't selected anything for the water in the custom zoomlevel maker. -2 or 3 minutes after loading in, I always get a CTD, when the ortho tile with sonny's .hgt file is in my custom scenery folder. Sometimes it closes with a Vulkan device error message and sometimes it closes without any warning. Do you have any solution to that? Or are you at least able to recreate that on that tile?

TheA321Channel avatar Jul 18 '24 09:07 TheA321Channel

For tile +47+1 I get: Min altitude: 52.0 , Max altitude: 258.6667 , Mean: 116.521545 from Viewfinder Panoramas 1" elevation data. What version of Ortho4XP are you using? Crash has been discussed here: https://github.com/oscarpilote/Ortho4XP/issues/260 Water in tile +47+1 is partially 2d/partially3d - as far I can see. It is how bathymetry data is coded in XP12 for this region.

w8sl avatar Jul 18 '24 11:07 w8sl

For tile +47+1 I get: Min altitude: 52.0 , Max altitude: 258.6667 , Mean: 116.521545 from Viewfinder Panoramas 1" elevation data. What version of Ortho4XP are you using? Crash has been discussed here: #260 Water in tile +47+1 is partially 2d/partially3d - as far I can see. It is how bathymetry data is coded in XP12 for this region.

Actually I meant to write +47+09 (with lake of constance) I have no idea how I got to 1 😂 For lake of constance, the water is fully 3d, at least without Orthos.. Also, I'm using V1.4 with XP12 water tech option

TheA321Channel avatar Jul 18 '24 17:07 TheA321Channel

Tile +47 +009 is affected by the problem fixed with #272 Update your src/O4_DEM_Utils.py file from the pull request or download from source repisitory: https://github.com/w8sl/Ortho4XP/tree/Fix_download_elevation_data Sonny´s .hgt file should work even better. Try with: use_masks_for_inland = True imprint_masks_to_dds = False

w8sl avatar Jul 18 '24 18:07 w8sl

Thanks; I got the file and I'm downloading the tile right now. Will give an update

TheA321Channel avatar Jul 19 '24 06:07 TheA321Channel

Okay so I made the tile, it all works but water is still not 3d, I don't know what's causing that. At least it doesn't crash anymore, thank you

TheA321Channel avatar Jul 19 '24 12:07 TheA321Channel

I have done a quick test with:

water_tech: XP12 use_masks_for_inland = True imprint_masks_to_dds = False

All other settings default. Water is 3D on my end. BTW: in order to revert to default settings, just delete Ortho4XP.cfg file in the main O4XP directory. Restart O4XP, change settings as suggested above, hit "Apply" then "Write App Cfg"

w8sl avatar Jul 19 '24 13:07 w8sl