shred86/Ortho4XP

Could not locate image file for terrain

Closed this issue · 9 comments

I'm having some trouble with textures not being found. This seems to happen on tiles with a significant coastal area. One example I've got is +40-074.

Screenshot 2024-06-30 at 8 07 59 PM

I'm running macOS via homebrew, version 1.40.05. This is my config:

apt_smoothing_pix=24
road_level=1
road_banking_limit=0.5
lane_width=5.0
max_levelled_segs=100000
water_simplification=0.0
min_area=0.001
max_area=200.0
clean_bad_geometries=True
mesh_zl=19
curvature_tol=1.0
apt_curv_tol=0.5
apt_curv_ext=0.5
coast_curv_tol=1.0
coast_curv_ext=0.5
limit_tris=0
min_angle=10.0
sea_smoothing_mode=zero
water_smoothing=10
iterate=0
mask_zl=14
masks_width=100
masking_mode=sand
use_masks_for_inland=False
imprint_masks_to_dds=True
distance_masks_too=False
masks_use_DEM_too=False
masks_custom_extent=
cover_airports_with_highres=True
cover_extent=1.0
cover_zl=19
sea_texture_blur=0.0
water_tech=XP12
ratio_water=0.25
ratio_bathy=1.0
normal_map_strength=1.0
terrain_casts_shadows=True
overlay_lod=25000
use_decal_on_terrain=False
custom_dem=
fill_nodata=True
verbosity=1
cleaning_level=2
overpass_server_choice=DE
skip_downloads=False
skip_converts=False
max_convert_slots=8
check_tms_response=True
http_timeout=10
max_connect_retries=5
max_baddata_retries=5
ovl_exclude_pol=[0]
ovl_exclude_net=[]
custom_scenery_dir=/Users/user1/X-Plane 12/Custom Scenery
custom_overlay_src=/Users/user1/X-Plane 12/Global Scenery/X-Plane 12 Global Scenery
custom_overlay_src_alternate=

Are you seeing any errors during the build process? I just tried building the same tile (+40-074) and the only error I see is:

[Errno 2] No such file or directory: '/Users/my_user/Projects/Ortho4XP/Elevation_data/+30-080/N39W074.hgt'
    ERROR: in reading elevation from /Users/my_user/Projects/Ortho4XP/Elevation_data/+30-080/N39W074.hgt -> replaced with zero altitude.

But I think that is expected based on N39W074 being in the ocean. Otherwise, everything seems to load fine on my end.

I just tried to run it again on that tile. At the end of Step 3, I noticed that got the following:

Removing obsolete texture 49520_38592_BI17.dds
Removing obsolete texture 197312_154608_BI19.dds
Removing obsolete texture 197344_154560_BI19.dds
Removing obsolete texture 197280_154640_BI19.dds
Removing obsolete texture 49168_38864_BI17.dds

Then when I try to load into KJFK, I get this error, which matches one of the obsolete textures removed above:

Screenshot 2024-07-01 at 12 16 53 PM

Out of curiosity, I deleted the terrain files associated with those textures, then loaded in KJFK. I was able to load this time, but I got a warning that the scenery pack was missing files and wouldn't be loaded.

Screenshot 2024-07-01 at 12 51 00 PM

I think I found the issue. Testing a fix, will send a pull request if it works.

That is really strange. Definitely curious to see what you found! Did you happen to try this on the original Ortho4XP as well? I'm hoping it's not an issue I introduced with changes I made but I really didn't touch anything with the build process. If you can post your tile configuration (with the zone_list), I can try it out on both this forked version and the original version.

@shred86 I sent a PR, doesn't look related to anything you've done!

Here's my tile configuration if you want to test it out:

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

I've spent a little bit of time looking at this and the first thing I realized is I wasn't originally seeing this issue because I had my cleaning_level set to 1, which is why the remove_unwanted_textures function wasn't being called. Now that I set it to 2, I'm having the same results.

I stepped through that function while it was running just to make sure I fully understand the issue. You probably already went through this but I just want to make sure I understand exactly what's broken and what we're going to change, so this is more for me than anything. 😄

How remove_unwanted_textures currently functions:

  • For any file that is *.ter, replace the .ter extension with .dds and append it to texture_list.
  • For any file that is *_water_overlay.ter, remove the _water_overlay and also replace the .ter extension with .dds, and append it to the list.
  • For any file that is *_sea.ter, it's doing the same thing in the first example (replacing the extension) so the file becomes *_sea.dds and appended to the list, except in this case we actually want to remove _sea.
  • So what appears to be happening is any *_sea.ter file that doesn't also have an overlay will have its .dds file deleted by this function because it's not being properly renamed; the _sea portion should be removed.

The proposed change is now just properly renaming the *_sea.ter files so when the second part of the function runs, it doesn't delete those .dds files. The only thing I'm not 100% certain on is there any other type of .ter file that isn't being accounted for with this change? I looked through all of my tiles (all within the U.S.) and didn't see anything, so I'm assuming it's just the three different .ter files we're talking about.

Otherwise, this all makes sense to me. Even though I'm 99.99% sure this wasn't based on any changes I made, I replicated this in the original version of Ortho4XP and it certainly is an issue there as well.

Great find and I really appreciate you taking the time to create the fix too! I'll get this incorporated into the next release.

Yep, this all tracks with what I was seeing. I didn't make the connection about cleaning_level being set to 2, though, that makes sense!

Fixed in 1.40.06!