• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Help with USGS NAIP / FWTools Ortho inside Prepar3D.

Messages
4
Country
australia
Hello,
I am attempting to convert USGS NAIP imagery downloaded from USGS Earth Explorer for use inside Prepar3D v5. I've followed the Prepar3D tutorial "Advanced Tutorial: Updating the globe & importing imagery". I believe I've followed this as I have managed to get the imagery into the simulator however there are large black triangle along the edge where there appears to be missing data?
8cc2c191bca6a3ce4984c484e1367202.png

I've included a couple images showing the issue I am having with. One is of TMFViewer showcasing what the BGL looks like inside the simulator and another showing the two images, one the raw TIF file downloaded from USGS and another after being processed by FWTools (The FWTools one looks to be extremely over exposed however this does not show in the simulator). There is something happening in FWTools that's causing the black boxes/triangles to appear along the edge but I'm not sure how to fix this. I'm using FWTools 2.47 to do these conversions.
90f98193fc5f9325edee9849c2eeb23c.jpg

I thought about trying to put a blendmask over these but haven't been successful in the INF phase before compiling as the main Ortho is a GeoTiff with the location baked into the Tif! I also tried removing the black triangles in a photo editor but I can't get it to open correctly as the Tif has a bunch of different channels.

Any help would be appreciated,
Thanks.
 
I'm not familiar with FWTools but is looks like it is reprojecting the USGS image into WGS84 projection. It's doing this because P3Dv5 uses WGS84 as it's projection method. You need to add NullValue = 0,0,0 into your input file. This tells resample to ignore any pure black pixels. The black triangles should be gone.
 
I'm not familiar with FWTools but is looks like it is reprojecting the USGS image into WGS84 projection. It's doing this because P3Dv5 uses WGS84 as it's projection method. You need to add NullValue = 0,0,0 into your input file. This tells resample to ignore any pure black pixels. The black triangles should be gone.
Thanks, that fixed it & removed the black triangles. I must have glossed over that. I'm now trying to find out how to add a water & blend mask into the TIF as different channels. At least I hope it's possible to do so!
 
I'm glad that solved the problem. The sdk can provide you with the guidance that you need to add water and blend masks.
 
There is something happening in FWTools that's causing the black boxes/triangles to appear along the edge but I'm not sure how to fix this.

As Ed said this happens when you reproject between NAD83 and WGS84. Usually it won't matter because you'll make a blendmask that blends the wedges out anyway. NullValue = 0,0,0 also works but usually you'll make color corrections to your imagery and those will turn parts of the imagery pure black (0,0,0), those areas will appear as holes in your photoreal so if you use NullValue = 0,0,0 you should replace any black with "almost black" (2,2,2) everywhere except the wedge areas just before you export a .tif for resample.

You can also define extents in your gdalwarp command to cut the black wedges off if you want to:

gdalwarp -of GTiff -co "INTERLEAVE=PIXEL" -te -106.5000 35.9375 -106.4375 36.0000 -t_srs "+proj=latlong +datum=WGS84" -r cubic "C:\path\to\m_3510605_nw_13_060_20180528.tif" "C:\path\to\output_WGS84.tif"

the coordinates are as follows:
gdalwarp -of GTiff -co "INTERLEAVE=PIXEL" -te WEST SOUTH EAST NORTH -t_srs "+proj=latlong +datum=WGS84" -r cubic "C:\path\to\m_3510605_nw_13_060_20180528.tif" "C:\path\to\output_WGS84.tif"

(hint: In SbuilderX do File > Add map > From disk, add your reprojected .tif. Use the exclude tool to draw a box that stops just short of the black wedges on all four sides, use the coordinates from the exclude dialog in your gdalwarp command.)


I'm now trying to find out how to add a water & blend mask into the TIF as different channels. At least I hope it's possible to do so!

What are you using for software? I do that all the time in my ancient version of PhotoShop (CS2), just open the channels palette and you can edit the alpha almost as if it were another layer. I'm sure you can also do this in Gimp as well but I'm afraid I couldn't tell you how.

The NAIP imagery will already have an "Alpha1" channel which is the NIR (near infrared) and the water will be clearly visible as nearly black against a grayish background, I use the magic wand tool to select all the black water areas, fill them with pure black, invert the selection and fill the remainder with pure white. That becomes my water mask. Then also on the channels palette I add an Alpha2 channel and make a blendmask. out of it. Pure white where you want the imagery to show and pure black where you don't. You can use a feather on the blend to make the photoreal blend in gradually, preferably no feather on the watermask. When you export a .tif from PhotoShop the two channels will be included, Alpha1 (channel 3) is always the water mask, Alpha2 (channel 4) is the blend. If you do nothing with the reprojected NAIP imagery the NIR channel will be interpreted as the watermask and your entire photoreal will be "wet".

(The FWTools one looks to be extremely over exposed however this does not show in the simulator)
That's the NIR channel that does that. As you said it doesn't show in the sim, but my guess is if you look closer you'll notice the entire photoreal appears "wet".
 
What region are you wanting to create photoreal scenery for? I have a pretty easy process I've fine-tuned, thanks to help from Gary and Jim, and would be happy to share what I've learned so far.

I use the USGS National Map (https://viewer.nationalmap.gov/basic/) instead of Earth Explorer, which doesn't have those annoying black wedges to remove. I can grab several tiles and convert them into a single .BGL file in about 15 minutes or so. That's reprojecting to WGS84, stripping out the IR channel, tweaking color, creating watermask, then compiling it all back together and resampling. I use QGIS,GIMP, and NConvert to get the job done, and they are all free, but I am sure there are better ways than what I've worked out so far. Let me know if there is anything I can share.

Best,
 
What area are you looking for? I have tools to rapidly deploy NAIP data, with full water mapping, autogen, nightlights etc. If it's western USA I could send you a copy, if eastern I can render any area rapidly.
 
All of California, Oregon, Idaho, Montana, Utah, Colorado, New Mexico, Wyoming, Arizona and Delaware are done. Nevada is 80% complete as is Washington State. I think i got North and South Dakota done as well.
 
I'd love to see northern California, especially the areas around Herlong (NW of Lake Tahoe) and Beale AFB if you do requests.
 
Back
Top