- Messages
- 42
I am adapting my port of Ortho4XP to FS2004 (https://github.com/stackTom/Ortho4XP_FSX_P3D). I can't seem to figure out how to calculate the appropriate coordinates for the destination to fit within each LOD 13 terrain cell. The SDK says that "Each terrain cell falls on a multiple of 360/32768 degrees latitude, which is 0.010986328125 decimal degrees and 480/32768 degrees longitude, which is 0.0146484375 decimal degrees."
So, I do this:
new latitude = Floor(latitude / 0.010986328125)* 0.010986328125
new longitude = Floor(longitude / 0.0146484375) * 0.0146484375
if latitude or longitude are positive and do this, if negative:
new longitude = Ceiling(latitude / 0.010986328125)* 0.010986328125
new longitude = Ceiling(longitude / 0.0146484375) * 0.0146484375
I do this to fit the scenery onto the LOD 13 cell bounds...
For example, assume north latitude is 51.17934297928926, south latitude is 50.958426723359935, west longitude is -0.3515625, and east longitude is 0.0. We get:
new north latitude = Floor(51.17934297928926 / 0.010986328125) * 0.010986328125 = 51.17431640625
new south latitude = Floor(50.958426723359935 / 0.010986328125) * 0.010986328125 = 50.95458984375
new west longitude = Ceiling(-0.3515625 / 0.0146484375) * 0.0146484375 = -0.3515625
new east longitude = Floor(0.0 / 0.0146484375) * 0.0146484375 = 0.0
Nevertheless, I get the infamous rim of water around the scenery. What I am doing wrong. I think I am interpreting the SDK incorrectly, but can't figure out what I'm doing wrong.
Do images have to be in a 3:4 aspect ratio? This is how the example in the SDK is. Furthermore 0.010986328125 / 0.0146484375 = 3/4 as well...
So, I do this:
new latitude = Floor(latitude / 0.010986328125)* 0.010986328125
new longitude = Floor(longitude / 0.0146484375) * 0.0146484375
if latitude or longitude are positive and do this, if negative:
new longitude = Ceiling(latitude / 0.010986328125)* 0.010986328125
new longitude = Ceiling(longitude / 0.0146484375) * 0.0146484375
I do this to fit the scenery onto the LOD 13 cell bounds...
For example, assume north latitude is 51.17934297928926, south latitude is 50.958426723359935, west longitude is -0.3515625, and east longitude is 0.0. We get:
new north latitude = Floor(51.17934297928926 / 0.010986328125) * 0.010986328125 = 51.17431640625
new south latitude = Floor(50.958426723359935 / 0.010986328125) * 0.010986328125 = 50.95458984375
new west longitude = Ceiling(-0.3515625 / 0.0146484375) * 0.0146484375 = -0.3515625
new east longitude = Floor(0.0 / 0.0146484375) * 0.0146484375 = 0.0
Nevertheless, I get the infamous rim of water around the scenery. What I am doing wrong. I think I am interpreting the SDK incorrectly, but can't figure out what I'm doing wrong.
Code:
[Source]
Type = MultiSource
NumberOfSources = 6
[Source1]
Season = Summer
Variation = January,February,March,April,May,June,July,August,September,October,November,December
Type = Custom
Layer = Imagery
SourceDir = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214.tga
Lon = -0.3515625
Lat = 51.17934297928926
NumOfCellsPerLine = 4096 ;Pixel isn't FSX/P3D
NumOfLines = 4096 ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint = 0
SamplingMethod = Point
NullValue = 255,255,255
[Source2]
Season = Spring
Variation = January
Type = Custom
Layer = Imagery
SourceDir = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214.tga
Lon = -0.3515625
Lat = 51.17934297928926
NumOfCellsPerLine = 4096 ;Pixel isn't FSX/P3D
NumOfLines = 4096 ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint = 0
SamplingMethod = Point
NullValue = 255,255,255
[Source3]
Season = Fall
Variation = January
Type = Custom
Layer = Imagery
SourceDir = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214.tga
Lon = -0.3515625
Lat = 51.17934297928926
NumOfCellsPerLine = 4096 ;Pixel isn't FSX/P3D
NumOfLines = 4096 ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint = 0
SamplingMethod = Point
NullValue = 255,255,255
[Source4]
Season = Winter
Variation = January
Type = Custom
Layer = Imagery
SourceDir = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214.tga
Lon = -0.3515625
Lat = 51.17934297928926
NumOfCellsPerLine = 4096 ;Pixel isn't FSX/P3D
NumOfLines = 4096 ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint = 0
SamplingMethod = Point
NullValue = 255,255,255
[Source5]
Season = HardWinter
Variation = January
Type = Custom
Layer = Imagery
SourceDir = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214.tga
Lon = -0.3515625
Lat = 51.17934297928926
NumOfCellsPerLine = 4096 ;Pixel isn't FSX/P3D
NumOfLines = 4096 ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint = 0
SamplingMethod = Point
NullValue = 255,255,255
[Source6]
Season = LightMap
Variation = LightMap
Type = Custom
Layer = Imagery
SourceDir = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14
SourceFile = 5472_8176_GO214_night.tga
Lon = -0.3515625
Lat = 51.17934297928926
NumOfCellsPerLine = 4096 ;Pixel isn't FSX/P3D
NumOfLines = 4096 ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 5.3934632795245296e-05
PixelIsPoint = 0
SamplingMethod = Point
NullValue = 255,255,255
[Destination]
DestDir = G:\Ortho4XP_FSX_P3D\Orthophotos\+50-010\+51-001\GO2_14\ADDON_SCENERY\scenery
DestBaseFileName = 5472_8176_GO214
BuildSeasons = 1
UseSourceDimensions = 0
CompressionQuality = 100
NorthLat = 51.17431640625
SouthLat = 50.95458984375
WestLon = -0.3515625
EastLon = 0.0
LOD = 13
Do images have to be in a 3:4 aspect ratio? This is how the example in the SDK is. Furthermore 0.010986328125 / 0.0146484375 = 3/4 as well...