BSQ2BMP mesh

General discussion about Scenery Design. Questions about SBuilder for Flight Simulator FS2004.
Post Reply
Gridley
Posts: 176
Joined: Tue Feb 22, 2005 12:28 am
Contact:

BSQ2BMP mesh

Post by Gridley » Tue Mar 07, 2006 10:20 pm

Is there a way to represent fractional meters in a BSQ? Currently, green represents 0-255 meters, in whole meter increments, correct? What if I wanted to be more precise?

Any info helpful!

Image

User avatar
Luis Sa
Posts: 1736
Joined: Sun May 18, 2003 11:17 am
Location: Portugal
Contact:

Post by Luis Sa » Wed Mar 08, 2006 4:47 am

Hi

No! but I think the mesh BGL that gets generated never has resolutions higher than 1 meter! Well I am not sure!

Regards, Luis

Gridley
Posts: 176
Joined: Tue Feb 22, 2005 12:28 am
Contact:

Post by Gridley » Wed Mar 08, 2006 11:28 am

Thanks Luis. I was afriad of that!
:D

Image

Magrao
Posts: 1
Joined: Sun Mar 19, 2006 8:33 pm
Location: Brazil

Post by Magrao » Sun Mar 19, 2006 9:00 pm

"Using Scaled Elevation Values

Flight Simulator supports scaled elevation values. The elevation resampler provides a capability whereby very precise elevation values can be specified at the expense of the range of these values. By default, the resampler expects elevation values to be in increments of one meter. However, with the BaseValue and FractionBits directive, you can specify different scalings for source and/or destination data.

For example, say you had source data with elevation measurements precise within 1/128 of meter. Since elevation values are represented as a signed 16-bit integer, the range of values a given integer can express is -32768 to 32767. As stated above, the resampler's default behavior is to assume the given elevation values to be in meters, which means the default range of values is -32768 meters to 32767 meters.

If you set the FractionBits directive to 1 in the [Source] section of the .inf file, the resampler knows that the source data is in the form of "15.1" numbers. This means that each number has 15 bits reserved for the whole number part and 1 bit reserved for the fractional part.

With a single bit used for fractions, a number can be precise to within one-half (since the first place-value after the decimal point in a binary number represents one-half). From this, it is evident that a 15.1 number is more precise than a 16-bit integer; however, its range is half of a 16-bit integer. The range of a 15.1 number is -16384 to 16383.5. Each increment to the number represents an increment by 1/2. So, a 1 means 1/2 meter, a 2 means 1 meter, a 3 means 1.5 meters, and so on.

Getting back to our example, we have source data precise to 1/128 meter. This means that a 1 equals 1/128 meter, a 2 equals 2/128 meter, and so on. To represent the example data properly, we need to specify 9 bits for the whole number part and 7 bits for the fraction part, or a 9.7 number. We do this with the following directive:

[Source]

FractionBits = 7

Since 9 bits are reserved for the whole number part, the range is -512 to 511.984375. This is a fairly narrow range. Unless the area on the earth represented by this data is below 512 meters (and above -512 meters), there would be a problem representing the magnitude of the elevations. An elevation of 1000 meters, for example, cannot be expressed with a "9.7" scaled number. It is outside of the range. To solve this problem, the directive BaseValue can be used to define a "zero point" for the elevation values. For example, if the following is specified:

[Source]

FractionBits = 7
BaseValue = 1000

A value of zero in the source data means 1000 meters. A value of 1 means
1000 + 1/128 meter (or 1000.78125).

You can use the FractionBits and BaseValue directives in either the [Source] or [Destination] sections, or in both sections. In the case where these directives specify different scalings in the [Source] and [Destination] sections, the resampler will attempt to form the source scale to the destination scale. If a loss of precision occurs, the resampler will print an error message."

The following example is an .inf used by Resample.exe for a more precise MESH_Rio de Janeiro created for me:

[Destination]

LOD = AUTO
DestDir = "."
DestBaseFileName = "MESH_RIO_I_GrdRet"
UseSourceDimensions = 1
<b>FractionBits = 3</b> <i>(1/8 meters)</i>
BaseValue = 0

[Source]

Type = ElevS16LSB
SourceDir = "C:\Documents and Settings\Administrador\.....\Arquivos RAW\"
SourceFile = "MESH_GrdRet_WGS84.raw"
Lat = -22.701005
Lon = -43.815760
NumOfCellsPerLine = 3883
NumOfLines = 2169
CellXdimensionDeg = 0.0001953600333449
CellYdimensionDeg = 0.0001796895027868
FractionBits = 0
BaseValue = 0
ScaleinMeters = 1.0

Post Reply