Jump to content

How FSX Scenery loading works?


fighting

Recommended Posts

Hey guys,

 

I really want to know how FSX's scenery loading mechanism works, it includes the following questions:

1. I've seen the 4-digit numbered grid at https://msdn.microsoft.com/en-us/library/cc526966.aspx, but, how FSX finds, with each 4-digit number, the specific relevant files? (bgl, textures)

2. What is exactly the purpose of the BGL file, and how it affects the textures? (if it does).

3. How is the scenery file (scenery.cfg) connected to the whole thing?; how FSX finds the related textures files?; I mean, where it takes the information from?

 

The bottom line here is that I wish to understand how FSX maps each texture file to it's correct position in the FSX's world (the specific longitude/latitude and also altitude).

 

I've searched those questions a lot, but failed to find a decent answer.

Link to comment
Share on other sites

What do you mean by textures? Land Class?

 

I don't know exactly what land class means, so I'll try to explain myself:

My main goal is to download massive land terrain pictures from the internet and load them into FSX's world at run-time (something like TileProxy). That's why I'm trying so hard to understand this mechanism.

This needs to be done automatically, so there is no place for manual software in this situation.

 

To pull this off, I need to understand the following process:

The scenery.cfg contains many sections, called by [Area.nnn] (Actually, what is the meaning of 'nnn'?).

Now, let's say Area.001 refers to one BGL file (resides in the scenery directory):

 

- I've understood that the BGL file contains it's location (by the way, what is the format of the location?).

- Since the BGL "tells" FSX where it wants to be loaded, I guess that FSX knows also where to load all texture's directory contents - but
how it knows how to place each bmp/dds file in it's right position in it's world
?

- The last statement leads me to another question:
are all textures tightly-connected to the BGL file
? i.e., they cannot "exist" without it?

- Actually, if the scenery directory contains multiple BGL files,
how FSX separates between each BGL-texture relationship
? (If such a relationship do exists..)​

 

What about terrain.cfg? can you elaborate about it? specifically, what each [Texture.xxx] section means?

Link to comment
Share on other sites

Let's start with scenery.cfg. As you say this contains a list of sections called areas. Each section has a number which is a way that FS can reference it. Each section is actually a reference to a folder location where bgl files are stored. The stock areas refer to folders that contain the basic data for scenery. These are divided using a grid system. Each one is going to contain multiple bgl files - some are for terrain, some for airports, some for scenery, some for navigational aids and so on. FS loads files depending on the location you are. The order in which they get loaded is important since later loading ones can 'exclude' earlier loading ones. This article refers to airport scenery but the priority principle is the same for anything: https://scruffyduck.screenstepslive.com/s/help_docs/m/20268/l/199760-priority-matters

 

Land Class is the basic was that FS displays the picture on the ground. There are specific files in the scenery.cfg areas that store information about land class. The information is in the form of a series of polygons. Each polygon will have a set of vertex points describing it and there will also be a property of the polygon that references one of the textures. I am not a terrain expert but it sounds to me like you are trying to load photo scenery. Again this is going to be referenced in a Bgl file that contains the poly data plus information about what texture to use and the relationship of that texture to the poly.

Link to comment
Share on other sites

Thank you very much, what you've said is very helpful (great article by the way!).

 

Just to be sure I've understand you entirely:

- Let's say I've got a bunch of bmp files which I want them to be loaded - the BGL file will contain some reference to each file, so FSX will know about them too? is this reference contains also the accurate coordinate of where each bmp file should be loaded?

- Should I have no interest in the terrain.cfg? is it not related for what I'm trying to acheive?

Link to comment
Share on other sites

I can give you a specific example of the Custom Ground Poly function in Airport Design Editor. The user designs a polygon shape covering the area they want their image to appear. They then select the texture they want to use and align that texture to the poly in terms of size, orientation and so on. The texture can be and often is one they create themselves. This is then compiled into a bgl file using one of the different compilers we have to create bgl files. There are different ones depending on what you want to do. The bgl file contains the shape of the polygon and a reference t to the texture (which usually has to be in the texture folder corresponding to the scenery folder containing the bgl file).

 

When FS is loaded such that the poly is located in the view screen then the bgl file is loaded and displays the shape and texture on the ground.

 

For the regular land class textures a different compiler is used but the results are the same. In this case though FS will look in the common Texture folder.

 

I can't say about terrain.cfg but I suspect it is not going to be involved if you are planning to load custom textures (images). I personally have no idea how to load these on the fly since all my work is based around creating scenery in one place that stays there.

Link to comment
Share on other sites

I am not sure what you want. If you want to create bgl files that will display photo scenery based images in sim then you might be better looking at the SDK and how to compile them.

 

That article is about decompiling the file structure of that type of bgl file

Link to comment
Share on other sites

If you're familiar with TileProxy, you'll notice that it downloads the photo scenery and loads them on the fly.

My guess is that TileProxy generates bgl files (occures only one time - at installation) that contains terrain sections for the whole FSX's world.

That way, TileProxy is able to download the photos at run-time, and when FSX tries to load a new BGL, somehow that BGL refers FSX to the new photos.

 

So, my problem here is that I didn't find how the BGL tells FSX where it can find those photos (of course, I might be wrong, and TileProxy doesn't work that way, but it makes sense).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...