Some results on High Resolution Photo Scenery

General discussion about Scenery Design. Questions about SBuilder for Flight Simulator FS2004.
Post Reply
User avatar
Luis Sa
Posts: 1736
Joined: Sun May 18, 2003 11:17 am
Location: Portugal
Contact:

Some results on High Resolution Photo Scenery

Post by Luis Sa » Tue Apr 05, 2005 5:23 am

Hi,

Here is a description of what I got so far.

My aim is to apply high resolution pictures to the terrain. I want to try 1.2meter/pixel resolution (using 1024 x 1024 bitmaps) and 2.4meter/pixel resolution (using 512 x 512 bitmaps). I want to integrate this with the "normal" VTP photo scenery already implemented in SBuilder. The VTP photo scenery uses textures of 256 x 256 pixels corresponding to a resolution of 4,8 meter/pixel.

I used the Atlantic as test region. Note that I am using test data and no real data or pictures. I pick up the Cell at N40 W40 and I used a mesh map as depicted in the figure:

Image


You note 6 photo tiles on the top on a plan region and 6 other photo tiles on the center on a mountain region. This mesh map is precisely a 257 x 257 bitmap which was converted from a 257 x 257 BSQ file of altitudes. The first thing that I would like to focus is that I altered the calibration of the map. The borders for the 298_142 Cell are:

North=40.078125
South=39.7265625
West=-40.3125
East=-39.84375

but I expanded by 1/2 of a pixel in each direction. With a pen and paper you can see that this expansion corresponds to the following values:

[GEOGRAPHIC]
North=40.07881165
South=39.72587585
West=-40.31341553
East=-39.84283447

and look to the NW corner of the display to see the 1/2 pixel display:

Image


The reason for this is to make the FS sampling grid to be the center of the pixel. I add another parameter to the INI file called ExtMeshBitmap:

[Main]
ExtMeshBitmap=True

If I extend my mesh bitmap by 1/2 of pixel on the 4 directions I set ExtMeshBitmap=True in order to get the same final mesh BGL as if I had not done that. You can skip the following orange part which shows how I use the ExtMeshBitmap parameter in creating the INF file for mesh generation:

<font color="orange">
' create the INF
Open App.Path + "\tools\work\" + FileMeshName + ".INF" For Output As #3
Print #3, "[Source]"
Print #3, " Type = ElevS16LSB"
Print #3, " SourceDir = "; Chr(34); "."; ; Chr(34)
Print #3, " SourceFile = "; Chr(34); FileMapName; Chr(34)
NLAT = Maps(Map).NLAT2
SLAT = Maps(Map).SLAT2
WLON = Maps(Map).WLON2
ELON = Maps(Map).ELON2
ROWS = Maps(Map).Rows2
COLS = Maps(Map).Cols2
If ExtMeshBitmap Then
Delta = (NLAT - SLAT) / ROWS / 2
NLAT = NLAT - Delta
SLAT = SLAT + Delta
Delta = (ELON - WLON) / COLS / 2
WLON = WLON + Delta
ELON = ELON - Delta
End If
Print #3, " CellType = S16LSB"
Print #3, " NullCellValue = -32768"
Print #3, " Lat = "; CStr(NLAT)
Print #3, " Lon = "; CStr(WLON)
Print #3, " NumOfCellsPerLine = "; CStr(COLS)
Print #3, " NumOfLines = "; CStr(ROWS)
Print #3, " CellXdimensionDeg = "; CStr((ELON - WLON) / (COLS - 1))
Print #3, " CellYdimensionDeg = "; CStr((NLAT - SLAT) / (ROWS - 1))
Print #3, " ScaleinMeters = 1"
</font id="orange">


In the picture above the thick red line marks the LOD8 grid (the corner of a Cell), the thin red line marks the LOD13 grid (or Areas or photo tiles) and the red dot line marks the LOD16 grid. This LOD16 grid is the sampling grid for "LOD8" mesh scenery. In applying photo textures I force the terrain to be a LOD8 mesh. To achieve this I added a button to the Mesh Properties window:

Image

The button is called "Make Flattens" and if I press it, SBuilder looks for photo-tiles (remember I had 6 + 6 = 12) that have a bitmap mesh underneath. For all the photo tiles that are "planted" on a mesh map, SBuilder reads the altitudes of the mesh map (that is why I extended the mesh maps 1/2 pixel) and creates 128 LWM flatten triangles (either LWM2 or LWM3). Here is the result:

Image

If I zoom in we can see the triangles. You will see that the vertices do not coincide. This was the best I could do for the flatten (tilted) triangles to follow the mesh.

Image


The idea was to force the mesh to be a set of triangles so that I could paint those triangles with the detailed textures. <b>I had limited success here!</b> Even reducing TERRAIN_MAX_VERTEX_LEVEL=18 (maximum mesh resolution = LOD8) I could not get the triangles to behave as I expected. I do not know if I keep this. May be I left it as it stands and I add some more parameters to the INI files such as:

AltitudeGap=
ZbiasValue=

For example I could set AltitudeGap=2 meters to force the textured triangles to be 2 meters higher than the mesh. But to understand the problem I need to refer to the photo triangles. I changed the compilation window regarding to photo scenery:

Image

On the top left corner I have 2 more check boxes. The Make Bitmaps is not ready yet but it simple will generate 512 x 512 or 1024 x 1024 bitmaps. These bitmaps will be high resolution "replicas" of the normal 256 x 256 bitmaps used in VTP photos. This make life easier if the flattens, describe above, fail to force the mesh to be "LOD8 triangles". The other check box is Make BGLs. This will generate trianngles whose vertices coincide with the vertices of the flatten triangles. Here is the code (the texture list part is not yet finished - also seasons to be included!):

<font color="green">
Header( 1 41 39 -39 -41 )
LatRange( 39 41 )

; High Resolution Photo # 1

Area( B 40.05065918 -40.18798828 50 )
LayerCall( :lcall 4 )
Jump( : )
:lcall
RefPoint( 2 :return 1 40.05065918 -40.18798828 E= 0 v1= 20000 v2= 1200 )
BGLVersion( 0800 )
TextureList( 0 6 FF 255 255 255 0 50.000000 "green.bmp" )
MaterialList( 0 0.10 0.80 0.20 1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 1.00 0.00 )
VertexList( 0
-624.2233 0402.050 -611.5540 0.0 1.0 0.0 0.000 0.000 ; vertex #000
-468.1675 0410.050 -611.5540 0.0 1.0 0.0 0.125 0.000 ; vertex #001
-312.1117 0415.050 -611.5540 0.0 1.0 0.0 0.250 0.000 ; vertex #002
-156.0558 0429.050 -611.5540 0.0 1.0 0.0 0.375 0.000 ; vertex #003
000.0000 0431.050 -611.5540 0.0 1.0 0.0 0.500 0.000 ; vertex #004
156.0558 0432.050 -611.5540 0.0 1.0 0.0 0.625 0.000 ; vertex #005
312.1117 0440.050 -611.5540 0.0 1.0 0.0 0.750 0.000 ; vertex #006
468.1675 0439.050 -611.5540 0.0 1.0 0.0 0.875 0.000 ; vertex #007
624.2233 0435.050 -611.5540 0.0 1.0 0.0 1.000 0.000 ; vertex #008
-624.2107 0415.050 -458.6655 0.0 1.0 0.0 0.000 0.125 ; vertex #009
-468.1581 0413.050 -458.6655 0.0 1.0 0.0 0.125 0.125 ; vertex #010
-312.1054 0415.050 -458.6655 0.0 1.0 0.0 0.250 0.125 ; vertex #011
-156.0527 0420.050 -458.6655 0.0 1.0 0.0 0.375 0.125 ; vertex #012
000.0000 0430.050 -458.6655 0.0 1.0 0.0 0.500 0.125 ; vertex #013
156.0527 0439.050 -458.6655 0.0 1.0 0.0 0.625 0.125 ; vertex #014
312.1054 0442.050 -458.6655 0.0 1.0 0.0 0.750 0.125 ; vertex #015
468.1581 0445.050 -458.6655 0.0 1.0 0.0 0.875 0.125 ; vertex #016
624.2107 0446.050 -458.6655 0.0 1.0 0.0 1.000 0.125 ; vertex #017
-624.1982 0420.050 -305.7770 0.0 1.0 0.0 0.000 0.250 ; vertex #018
-468.1486 0421.050 -305.7770 0.0 1.0 0.0 0.125 0.250 ; vertex #019
-312.0991 0420.050 -305.7770 0.0 1.0 0.0 0.250 0.250 ; vertex #020
-156.0495 0421.050 -305.7770 0.0 1.0 0.0 0.375 0.250 ; vertex #021
000.0000 0427.050 -305.7770 0.0 1.0 0.0 0.500 0.250 ; vertex #022
156.0495 0435.050 -305.7770 0.0 1.0 0.0 0.625 0.250 ; vertex #023
312.0991 0441.050 -305.7770 0.0 1.0 0.0 0.750 0.250 ; vertex #024
468.1486 0444.050 -305.7770 0.0 1.0 0.0 0.875 0.250 ; vertex #025
624.1982 0448.050 -305.7770 0.0 1.0 0.0 1.000 0.250 ; vertex #026
-624.1856 0421.050 -152.8885 0.0 1.0 0.0 0.000 0.375 ; vertex #027
-468.1392 0423.050 -152.8885 0.0 1.0 0.0 0.125 0.375 ; vertex #028
-312.0928 0425.050 -152.8885 0.0 1.0 0.0 0.250 0.375 ; vertex #029
-156.0464 0426.050 -152.8885 0.0 1.0 0.0 0.375 0.375 ; vertex #030
000.0000 0429.050 -152.8885 0.0 1.0 0.0 0.500 0.375 ; vertex #031
156.0464 0430.050 -152.8885 0.0 1.0 0.0 0.625 0.375 ; vertex #032
312.0928 0432.050 -152.8885 0.0 1.0 0.0 0.750 0.375 ; vertex #033
468.1392 0438.050 -152.8885 0.0 1.0 0.0 0.875 0.375 ; vertex #034
624.1856 0442.050 -152.8885 0.0 1.0 0.0 1.000 0.375 ; vertex #035
-624.1730 0421.050 000.0000 0.0 1.0 0.0 0.000 0.500 ; vertex #036
-468.1298 0421.050 000.0000 0.0 1.0 0.0 0.125 0.500 ; vertex #037
-312.0865 0426.050 000.0000 0.0 1.0 0.0 0.250 0.500 ; vertex #038
-156.0433 0426.050 000.0000 0.0 1.0 0.0 0.375 0.500 ; vertex #039
000.0000 0426.050 000.0000 0.0 1.0 0.0 0.500 0.500 ; vertex #040
156.0433 0428.050 000.0000 0.0 1.0 0.0 0.625 0.500 ; vertex #041
312.0865 0425.050 000.0000 0.0 1.0 0.0 0.750 0.500 ; vertex #042
468.1298 0431.050 000.0000 0.0 1.0 0.0 0.875 0.500 ; vertex #043
624.1730 0432.050 000.0000 0.0 1.0 0.0 1.000 0.500 ; vertex #044
-624.1604 0417.050 152.8885 0.0 1.0 0.0 0.000 0.625 ; vertex #045
-468.1203 0420.050 152.8885 0.0 1.0 0.0 0.125 0.625 ; vertex #046
-312.0802 0422.050 152.8885 0.0 1.0 0.0 0.250 0.625 ; vertex #047
-156.0401 0421.050 152.8885 0.0 1.0 0.0 0.375 0.625 ; vertex #048
000.0000 0420.050 152.8885 0.0 1.0 0.0 0.500 0.625 ; vertex #049
156.0401 0419.050 152.8885 0.0 1.0 0.0 0.625 0.625 ; vertex #050
312.0802 0414.050 152.8885 0.0 1.0 0.0 0.750 0.625 ; vertex #051
468.1203 0423.050 152.8885 0.0 1.0 0.0 0.875 0.625 ; vertex #052
624.1604 0420.050 152.8885 0.0 1.0 0.0 1.000 0.625 ; vertex #053
-624.1479 0407.050 305.7770 0.0 1.0 0.0 0.000 0.750 ; vertex #054
-468.1109 0413.050 305.7770 0.0 1.0 0.0 0.125 0.750 ; vertex #055
-312.0739 0414.050 305.7770 0.0 1.0 0.0 0.250 0.750 ; vertex #056
-156.0370 0409.050 305.7770 0.0 1.0 0.0 0.375 0.750 ; vertex #057
000.0000 0409.050 305.7770 0.0 1.0 0.0 0.500 0.750 ; vertex #058
156.0370 0402.050 305.7770 0.0 1.0 0.0 0.625 0.750 ; vertex #059
312.0739 0398.050 305.7770 0.0 1.0 0.0 0.750 0.750 ; vertex #060
468.1109 0406.050 305.7770 0.0 1.0 0.0 0.875 0.750 ; vertex #061
624.1479 0405.050 305.7770 0.0 1.0 0.0 1.000 0.750 ; vertex #062
-624.1353 0397.050 458.6655 0.0 1.0 0.0 0.000 0.875 ; vertex #063
-468.1015 0403.050 458.6655 0.0 1.0 0.0 0.125 0.875 ; vertex #064
-312.0676 0395.050 458.6655 0.0 1.0 0.0 0.250 0.875 ; vertex #065
-156.0338 0392.050 458.6655 0.0 1.0 0.0 0.375 0.875 ; vertex #066
000.0000 0398.050 458.6655 0.0 1.0 0.0 0.500 0.875 ; vertex #067
156.0338 0383.050 458.6655 0.0 1.0 0.0 0.625 0.875 ; vertex #068
312.0676 0380.050 458.6655 0.0 1.0 0.0 0.750 0.875 ; vertex #069
468.1015 0382.050 458.6655 0.0 1.0 0.0 0.875 0.875 ; vertex #070
624.1353 0372.050 458.6655 0.0 1.0 0.0 1.000 0.875 ; vertex #071
-624.1227 0384.050 611.5540 0.0 1.0 0.0 0.000 1.000 ; vertex #072
-468.0920 0388.050 611.5540 0.0 1.0 0.0 0.125 1.000 ; vertex #073
-312.0614 0377.050 611.5540 0.0 1.0 0.0 0.250 1.000 ; vertex #074
-156.0307 0371.050 611.5540 0.0 1.0 0.0 0.375 1.000 ; vertex #075
000.0000 0383.050 611.5540 0.0 1.0 0.0 0.500 1.000 ; vertex #076
156.0307 0375.050 611.5540 0.0 1.0 0.0 0.625 1.000 ; vertex #077
312.0614 0360.050 611.5540 0.0 1.0 0.0 0.750 1.000 ; vertex #078
468.0920 0370.050 611.5540 0.0 1.0 0.0 0.875 1.000 ; vertex #079
624.1227 0374.050 611.5540 0.0 1.0 0.0 1.000 1.000 ; vertex #080
)
Zbias( 25 )
SetMaterial( 0 0 )
DrawTriList( 0
000 010 009 000 001 010 001 002 010 002 011 010 009 010 018 010 019 018 010 020 019 010 011 020
018 028 027 018 019 028 019 020 028 020 029 028 027 028 036 028 037 036 028 038 037 028 029 038
036 046 045 036 037 046 037 038 046 038 047 046 045 046 054 046 055 054 046 056 055 046 047 056
054 064 063 054 055 064 055 056 064 056 065 064 063 064 072 064 073 072 064 074 073 064 065 074
002 012 011 002 003 012 003 004 012 004 013 012 011 012 020 012 021 020 012 022 021 012 013 022
020 030 029 020 021 030 021 022 030 022 031 030 029 030 038 030 039 038 030 040 039 030 031 040
038 048 047 038 039 048 039 040 048 040 049 048 047 048 056 048 057 056 048 058 057 048 049 058
056 066 065 056 057 066 057 058 066 058 067 066 065 066 074 066 075 074 066 076 075 066 067 076
004 014 013 004 005 014 005 006 014 006 015 014 013 014 022 014 023 022 014 024 023 014 015 024
022 032 031 022 023 032 023 024 032 024 033 032 031 032 040 032 041 040 032 042 041 032 033 042
040 050 049 040 041 050 041 042 050 042 051 050 049 050 058 050 059 058 050 060 059 050 051 060
058 068 067 058 059 068 059 060 068 060 069 068 067 068 076 068 077 076 068 078 077 068 069 078
006 016 015 006 007 016 007 008 016 008 017 016 015 016 024 016 025 024 016 026 025 016 017 026
024 034 033 024 025 034 025 026 034 026 035 034 033 034 042 034 043 042 034 044 043 034 035 044
042 052 051 042 043 052 043 044 052 044 053 052 051 052 060 052 061 060 052 062 061 052 053 062
060 070 069 060 061 070 061 062 070 062 071 070 069 070 078 070 079 078 070 080 079 070 071 080
)
EndVersion
:return
Return
EndA

; High Resolution Photo # 2
</font id="green">

Now it is time for real world pictures with a GREEN TESTING TEXTURE! As I described I could not match the textured triangles with the "triangular mesh". Therefore the mesh (256 x 256 bitmaps) will protude, on same places, the green texture specially when I am very closed. The problem is severe on mountains regions. Using ZBias() can aleviate the effect. I have more tests to run.
This is the mountain part (6 photos all green)

Image

and this is the flatten area:

Image

Regards, Luis

boleyd
Posts: 402
Joined: Sun Sep 19, 2004 10:57 pm
Location: USA

Post by boleyd » Tue Apr 05, 2005 7:26 pm

Would the Texel adjustment on some video cards (Nvidia) help with filling the gaps in the photo textures.

I wonder what Microsoft would say about this. Do they know about this approach or are they amazed that someone discovered their little secret.

Thanks for what has to be a big excerise in patience.

Post Reply