• 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.

BGLDEC - A resample BGL (and CGL) DECompressor

Messages
277
Country
us-newyork
BGLDEC - A BGL DECompressor for resampled BGL files

This now also includes CGLDEC for MSFS!

BGLDEC is a utility that decompresses BGL files that are output from resample.exe.
A BGL file is decompressed into multiple binary or bitmap files that contain the raw data as it used by the simulator.
This includes elevation data, terrain photos, landclass, waterclass, season, region, and population density data.

CGLDEC does the same for CGL files in MSFS, which is still under development.
CGL files contain similar types of raster tile data, as well as world vector and autogen footprint data.


BGLDEC New Version: Beta 0.9.8
* New! Outputs terrain index tiles, as requested. These don't affect output but are useful for understanding FSX terrain
* Fixed! Slight change to logic for maximum Windows bitmap size (will write .bin instead)
* Changed! Internal efficiency changes to prep for merge with cgldec


CGLDEC New Version: Beta 0.2.0
* Decodes all Vector data to geojson!
* Method to query and extract a single tile
* Tools for working with and querying CGL at the package level and generating stats
* Fixes some bugs and now handles all CGL header types without crashes, and new quadkey format (3)



Please read the attached .txt files!

This is beta software, download as an attachment below.

Make sure you have installed the VC++2019 runtime (x64 version): https://aka.ms/vs/16/release/vc_redist.x64.exe

Please let me know of any issues you experience in this thread.
 

Attachments

  • bgldec_0_9_8.zip
    330.4 KB · Views: 97
Last edited:
Messages
277
Country
us-newyork
Updated to version 0.2.1

It can now decompress all raster sections that are processed by resample.exe including landclass, regions, imagery, etc.

I have also fixed several issues with the decompression itself as well as reduced memory usage to support more complex BGL files.

Also, all files are now output by QMID so they can be meaningfully processed. The file names are in Level-U-V.bin format. (Remember QMID levels are LOD + 2).
 
Messages
391
Country
newzealand
Wow that's pretty amazing, watching with interest...although I don't know what I'd use it for :)
 
Messages
277
Country
us-newyork
Thanks! New version 0.4.2 has been posted. This has better performance, support for variations and alpha masks, and can write aerial imagery chunks to human-readable bitmaps.

Now I'm focusing on bglstitch, a tool to merge various bin files into a single .raw + inf file.

Remember to run BGLDEC from your root sim folder (where all of the .dll files are) if you are decompressing aerial imagery or elevation data! The other types will work without this.
 

fs1

Messages
301
Country
brazil
Great job.

I was looking into this as well and came out with a similar solution - PTC to raster. I am wondering how useful a tool like this could be for the developer's community?

Any insights would be great to hear.
 
Last edited:

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
I just tried this tool, sadly the only thing it does is crashing immediately. :(

I placed it in my root fsx folder and gave it some dlls it was asking for.

Am I doing anything wrong?

Edit: I tried from inside P3Dv3 aswell and also in xp compatibiltiy mode. No change
 
Last edited:
Messages
26
Country
unitedstates
I think you forgot to compile this in release mode.

I've PMed you about this project and I'm really looking forward to hearing from you.
 
Messages
26
Country
unitedstates
I keep getting a missing c runtime debug dll missing error. I can't seem to fix it just by getting the dll and putting it into system32.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
30,616
Country
netherlands
Interesting thread Sean. I'll check out this new tool. Could open some possibilities for scenProc, like sample roof colours from the photo bgl.
 

GHD

Messages
12,198
Country
england
It created 8 256x256 pixel very low resolution bmps before crashing.

Initial bgl in TmfViewer:



Zoomed in:



Output from Bgldec:

 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
30,616
Country
netherlands
For the missing DLL files, it seems the tool was compiled in debug mode, since it is referencing the debug version of the C++ runtime files. I think these are in general only installed if you have Visual Studio installed. Sean, maybe you can make a release build?
 
Messages
26
Country
unitedstates
interesting. I have visual studio installed on a virtual machine. Maybe I should try it there.
 
Messages
26
Country
unitedstates
Actually, it really doesn't matter what resample uses; It matters what FSX/P3D use. If they can be read in the FS then it may open up the possibility of more flexibility in output of a redone resample.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
30,616
Country
netherlands
I'm not sure I understand your last two posts. This tool is a decompressor for the terrain bgl format. So it's a reverse resample and in that way it isn't relevant if FS can read it, it makes output for us as developer.
 
Messages
277
Country
us-newyork
Oh boy! Glad people are using it.

I've been offline and not actively working on this since September. I moved across the country again for work, second time in 2 years! Enjoying New York City now and things are finally calming down enough now that I am able to get back to work on this.

Arno, and Denali, you are correct in that I need a release build that is not dependent on the VC++ libs, complete oversight on my part. I'll get that done ASAP - that should fix a lot of errors for everybody. Also I will uplift to use the DLL's from P3D 3.1. Every time they release a new build the offsets change.

I am still working on removing the dependency on the simulator runtime. The, ummm, let's call it "re-engineering" of the PTC functions ended up being a much more difficult task than I expected. There were a lot of compiler optimizations turned on, making my job that much more difficult.
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
30,616
Country
netherlands
Hi,

Happy to hear you are still working on it. I can understand that moving across the country gives other priorities for a while :)

Since you say there is a dependency on the FS build, would we need different versions for FSX and P3D?
 
Messages
277
Country
us-newyork
Yes, it would need new versions. It would actually need the offsets from every build of the sim, as every recompile of the sim moves things around. So FSXA, FSXSP2, P3D 2.5, 3.0, 3.1 etc would all have different offsets. The last version posted here was built against P3D 2.5 hotfix 946.

Unfortunately, it gets more complicated than this, and this is going to be more difficult than I thought. I've spent the past couple days seeing what is involved in uplifting this to P3D 3.1, and it would appear that in the v3.x branch they have refactored some of the code I was hooking into out of the executable. Obviously there is still support for decompressing PTC in there, but is refactored to use a slightly different data structure and will take some work. Also it was compiled with VS2013 instead of VS2010, further changing the output.

I could go ahead and post a release build here, but it will only work with the P3D 2.5 libraries for any file containing PTC-compressed sections (most elevation and aerial imagery). Thoughts on whether this would be useful to anybody?

This is why I had been focusing on finishing on implementing my own PTC decompression methods before I paused working on this. Once that is done, there will be no dependency on the simulator at all, and bgldec can be run in complete isolation. However, this PTC work may very well be the most complex project I have ever taken on. :)

Let me do some groundwork over the next few days and see how involved all of this will be to get this working for 3.x.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
30,616
Country
netherlands
Hi,

I agree with you, this doesn't seem very practical, especially if every build is different. So then you would end up with a dozen of versions of the tool or so.
 
Messages
277
Country
us-newyork
New Version 0.5.1 has been posted.

BGLDEC has been updated to support the P3D v3.1 runtime. I was able to overcome the technical challenges mentioned above. Some other minor improvements and fixes are included as well, see the attached user manual.

I am still working on my PTC implementation, hopefully I can get this working soon. I am fighting some wicked bugs with it. The headers are working but the second I hit the first band the stack corrupts. Assembly language is nasty stuff, I am very thankful I do C# and node.js at my day job. :)

To Arno's point, this is still not an optimal solution, but hopefully it is usable for most until I can make more progress. I'll keep you guys posted.
 
Top