Latest posts.

P3D v2 and GPW gaps

In my post from two days ago I reported about gaps in my ground polygons, this lead me to discover the different resolution of BGLComp and BGLC generated BGL files. But it turned out that the gap was also caused by a programming mistake I made. The round earth correction was not completely correct for the P3D v2 output. I have fixed that now and as a result you can use the option to divide the polygons in a grid again. For the FS2002 style polygons that gave a better performance, I guess we need more testing to see if that is also the case for P3D. But in general it should be more efficient for the rendering engine if not all polygons have to be drawn.

The observations about the different positional resolution still stand, but they were not the cause of my gaps. So gaps fixed and still something interesting learned.

GPW update for P3D v2

I have just put an update of the ground polygon wizard (GPW) in the development release of ModelConverterX. With this update it is now possible to export P3D v2 MDL files from the GPW as well. These can be used in P3D v2 and it allows you to use the full material properties on your ground polygons. As Lockheed Martin has announced this is the way forward, the old FS2002-style ground polygons will be removed in the next major release.

Are there limitations in the P3D v2 export? Yes there are:

  • Seasons are disabled in the wizard, as these can’t be combined with MDL files
  • The visibility range is disabled in the wizard, as MDL files work with LODs. For the moment only one LOD is exported.
  • It is no longer possible to split your complex ground polygons into multiple groups. For P3D v2 they are always exported to one MDL file. This is because the BGLComp placement is less accurate and with multiple groups you would get gaps in between. If this leads to performance issues I can see if there are other optimizations that can be done.
  • I did notice with my test objects that some of them seem to disappear or flicker a bit in the distance (10 nm away or so). I guess when combined with some resample photo scenery below you will hardly see this. But maybe this can be prevented by adding LODs or something else. That’s something that needs some more testing, let me know if you have any issues or ideas on this.

I would suggest that you don’t use this new feature for production work yet. I do expect there might be a few bugs here and there left. So please go ahead and try to break test this new feature. Let me know if you have any suggestions or issues.

GPW and P3D v2

Today I have been experimenting with updating the ground polygon wizard of ModelConverterX to also export P3D v2 MDL files for ground polygons. Given the recent announcement by Lockheed Martin that the FS2002 style polygons will be dropped in the future, it became time to update the GPW.

The good news is that it was quite easy for me to ouput the ground polygons as P3D v2 MDL files. The layering information is stored in the material zbias property now, but for the rest it works similar to the FS2002 style polygons approach.

But I also found a problem. It seems the positional accuracy of BGLComp compiled scenery is much lower than that of SCASM based scenery. As a result of that, gaps will appear between the polygons when they are split up in different groups. I usually do this in the GPW to increase performance. So in the old FS2002 style code there would be multiple reference points, each containing the the polygons closest to that point.

I need to do a bit more thinking on how to handle this. Either  I will drop the option to group polygons for P3D v2 output or I need somehow use the same reference point for all groups. So there is some more experimenting to do before I can finish the GPW update.

Image2014-06-15 2125.08.955

And for those of your interested in the math of the positional accuracy. In the BGLComp BGL format the latitude and longitude are stored as 32 bit integer values. This means that an increase of the lat/lon value by 1 corresponds to 3.3528e-7 degrees for latitude and 4.4703e-7 degrees for longitude (at the equator). That roughly corresponds to 4 to 5 centimetre accuracy.

In the old FS2002 style scenery the latitude and longitude are stored as a 32 bit integer plus a 16 bit integer. This means that an increase of the 1 corresponds to 1.3731e-10 deg degrees for latitude and 1.2790e-12 degrees for longitude (again at the equator). This corresponds to an accuracy of around 0.015 millimetre.

I never realised before that the accuracy of placing objects was so different between both methods. The accuracy of the old method is probably a bit over the top, as you won’t see that difference. But for the BGLComp approach I would have expected a little more accuracy actually.

Updated options and better P3D support

I have updated the options form of scenProc and also added better P3D support. Before you had to trick the tool by pointing the FSX settings to P3D. You can see a screenshot of the new form below.

At the top part of the form you can choose which FS version is supported for the auto completion. So you choose from FS2004, FSX, Prepar3D v1 and Prepar3D v2. scenProc will then read the autogen configuration files from the selected version. You can enable only the versions you are developing for. The enabled versions here don’t influence to which FS version you can export, it’s only for the auto completion in the scenProc GUI. The radio button at the wrong is used to select the preferred version that will be selected by default.

Below you can set the paths to the different versions of the BGLComp compiler. This compiler is used by the EXPORTBGL step. If you don’t export to BGL, you don’t have the set these paths.

At the bottom of the form there are a few other options that influence the behaviour of scenProc. Set them as desired.

Image2014-06-08 2216.34.197

RADItor update

I have made a small update for RADItor. When you drop a file on the EXE, shortcut or on the main form it will now automatically be loaded. So you don’t have to manually browse for the file anymore in that situation.

The new version can be downloaded from the RADItor page.

Batch mode from command prompt

I already made these changes a few days ago in ModelConverterX, but since I didn’t write about them yet they probably went unnoticed by most of you. So let me document the changes I made to the batch mode.

First I add a checkbox to the batch convert wizard that allows you to select if you actually want to export objects. I added this because I wanted to generate screenshots in batch mode, so in that case exporting the objects is not needed. I guess making screenshots is the only use case for this feature, as all other batch operators only make sense if you export the object afterwards.

The second change I made is that you can now also start the batch mode from the command prompt. This can be done in two ways:

modelconverterx.exe -batch yourbatch.mbc

The command above will start ModelConverterX and load the select batch settings into the batch wizard and start processing them. So in this case you should save all objects you want to convert in the batch settings file.

modelconverterx.exe myfile.mdl -batch yourbatch.mbc

With the command above the specified file (myfile.mdl) will also be added to the list of objects to process in the batch wizard. So in this case you better save the batch settings without any files to convert and then you can specify on which file the batch operations should be run from the command prompt.

Place points along line updated

I have updated the PLACEPOINTSALONGLINE step of scenProc today. So if you grab the new development release tomorrow you will notice that the step takes two more arguments. So your existing configuration files need to be updated!

Please check the updated manual for all details of the changes. Below I will give a short summary. There are two main changes:

  • You can specify the distance from the start of the line to the first point now. Before that always defaulted to half the distance between the points.
  • You can choose between two modes now. The SINGLE mode is how the step worked before and the new CONTINUOUS mode has been added to allow you to create point features for a continuous row of library objects. See the details in the manual, but the idea is that you can for example place a median along a road using library objects and that they will form a continuous row.

Below is a picture showing the CONTINUOUS mode in action with a test object I made. I was actually planning to use it for cables between telephone poles, but it turned out easier to test with this median object. I’m sure you can find other ways to use it.



Align library objects

Imagine you have some vector data of gas stations and you want to use that to place autogen library objects. But your vector data only contains the location of the gas stations and no information about the heading at all. How to place these objects realistically in your scenery?

I have added a new step to scenProc last week already that helps in this situation. With this new step you can add a heading attribute to such features. And the heading will be derived from the direction of the nearest line to the point feature. So for the example here, that means you will align the gas station objects with the nearest road. That’s exactly what you want!

The small scenProc configuration below shows the basic usage of this new command:


You might notice I put the HEADINGFROMNEARESTLINE step before the SPLITGRID step. I did that on purpose, because the step only looks for lines within the same cell. So if you first split the objects, it might be that the closest line is not in the same cell anymore and you get the wrong heading.

And below is a picture to show it really works. In this blog post I have been talking about gas stations only, but I’m sure you can imagine many other types of objects that will benefit from this.


Autogen object distortion

Sometimes a very simple question on the forum can lead to interesting discoveries. In this case the question was why autogen buildings that look fine in Annotator are distorted in FS. Although the answer from an expert was that this is normal, I decided to have a look into this issue. In the end that gave me a better understand of how the autogen works, and I’ll try to write that down in this blog post. And I have also been able to improve scenProc now to automatically prevent this distortion.

Where does the distortion come from?

So where does the distortion actually come from? To understand that you need to know how autogen buildings are defined in the AGN file. Each building is defined using a corner coordinate, a direction vector and the size (length and width of the building).

If you look at the image below you see two buildings that are aligned correctly with the photo in Annotator (right side), while when viewed in FSX they have an heading offset (left side). This is the distortion issue that I was trying to understand.


How much distortion there is depends on the latitude of your scenery and on the heading of the building. Building that are oriented either horizontal or vertical are not affected. Buildings with a 45 degree heading are most affected.

Each autogen tile has a fixed size in degrees (actually 0.0146484375 by 0.010986328125 degrees). But of course the closer you get to the poles of the earth each degree is equal to less meters in distance. So the autogen tiles are getting more narrow the closer you get to the poles. This is also what you see in the image above, this is some photo scenery in northern Norway and in Annotator you can see the distortion in the photo scenery.

Due to the size of the autogen tile in degrees they correspond to a square area in meters at a latitude of 41.41 degrees. So around this latitude you don’t notice the problem, at a lower of higher latitude you will notice some distortion.

But where does that distortion come from? In Annotator you draw the orientation of the building on a photo that is shown in degrees and this orientation is stored as a direction vector in the AGN file. But it turns out that FSX uses this orientation is used when drawing the building in meters. So what does that mean? Let’s assume you drew the orientation as shown below on the left in Annotator in degrees. So your object has a heading of around 45 degrees. But since you are at a high latitude if you would draw the same arrow in meters you would get a heading as shown on the right. As you can see this is more like 60 degrees.


So this is the problem we are facing. Annotator shows the photo scenery in a different way and therefore you define the orientation wrong for the way that FSX later uses the information to render the autogen building. So actually it’s not an issue in FSX, it’s an issue in the Annotator tool.

The maximum heading offset you can get due to this problem is around around 20 degrees when you are at latitude 70 degrees. At latitude 41.41 there is no offset and at the equator there is an offset of around 8 degrees. These numbers apply to buildings at a 45 degree heading, for other headings the offset is less.

scenProc correction

So now that the cause of the heading distortion is understood, it was not so hard for me to alter the scenProc output to actually correct for this issue. So if you create the autogen with scenProc you shouldn’t encounter this anymore.

There is one “problem” with this correction however. When you look at your autogen in Annotator the objects will appear to have the wrong orientation. But once viewed in FSX everything is fine. This is shown in the image below.


And if you are not using scenProc to make your autogen and drawing it manually in Annotator, I’m afraid the only solution for now is to manually draw the objects at a different heading. But since the exact offset depends on the orientation of the building as well, that can be quite tricky to get right.

Drawcall batching, a no-brainer?

Ever since the release of FSX SP2 enabling drawcall batching has been a popular method of increasing the performance of scenery. The basic idea behind drawcall batching is that the scenery engine will gather all polygons with the same material, even if they belong to different objects, and then render them in one go. This eliminates the overhead of switching material and texture settings multiple times and therefore improves the performance.

But is it a good idea to always enable drawcall batching on objects? For a while we already know that drawcalls with too many polygons in them give trouble. They can result in disappearing objects for example. So in that case you better turn off the drawcall batching.

Last week while debugging an issue reported on the forum I found out that drawcall batching can have one more negative side effect. It turns out that when objects are used at higher altitude, the drawcall batching results in an offset of the position of the object. I never noticed this myself, since I’m from the Netherlands and always test my objects at sea level. But when you make scenery in a mountainous area you will for sure encounter this. So also in that case it might be better to turn off drawcall batching.

By default ModelConverterX has drawcall batching enabled, but you can easily disable it in the exporter options. If you encounter any of the issues described above, it might be a good try.

So it turns out that drawcall batching is not the magic performance solution we have thought for a long time, but if you are aware of the limitations you can still make good use of it.