Custom DEM creation with grises50: Difference between revisions

From FSDeveloper Wiki
Jump to navigationJump to search
No edit summary
(Infobox-Applicable-FSVersion added.)
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Infobox-Applicable-FSVersion
{{Infobox-Applicable-FSVersion
| FSXI = false
| P3D2 = true
| P3D = true
| FSXI = true
| FSXA = true
| FSXA = true
| FSX = true
| FSX = true
| FS2004 = false
| FS2004 = False
| FS2002 = false
| FS2002 = False
| FS2000 = unknown
| FS2000 = False
| FS98 = unknown
| FS98 = False
| XP10 = unknown
| XP9 = unknown
}}
}}
(a) install the FSX SDK installed on your system.
(a) install the FSX SDK installed on your system.
(b) download grises50 by Jokin BediaLauneta from ?? and unzip it to
                     
    whatever folder the system chooses.         
(b) download grises50 by Jokin BediaLauneta from http://users.skynet.be/maximil/grises50exe.zip and unzip it      
(c) create a folder called Mesh_Repair on your C drive,
to whatever folder the system chooses.         
and place a shortcut to this folder on your desktop.
   
(c) create a folder called Mesh_Repair on your C drive,            
and place a shortcut to this folder on your desktop.
                 
(d) copy the unzipped grises50 executable into Mesh_Repair.
(d) copy the unzipped grises50 executable into Mesh_Repair.
(e) add the following shortcuts to Mesh_Repair:
           
(e) add the following shortcuts to Mesh_Repair:              
   
   
to FSX to start the simulator,  
to FSX to start the simulator,  
                                     
to your Addon scenery folder,
to your Addon scenery folder,
                                       
to the resample program in your FSX SDK
to the resample program in your FSX SDK
to the tmfviewer        in your FSX SDK
                             
to the tmfviewer        in your FSX SDK  
                         


Add the following text file and save it as x.inf:  
Add the following text file and save it as x.inf:  


[Source]                                      
[Source]
                                     
Type              =  ElevS16LSB
Type              =  ElevS16LSB
                                                                       
Layer              =  Elevation
Layer              =  Elevation
                                                                           
ULXMAP            = -73.172208
ULXMAP            = -73.172208
                                                                               
ULYMAP            =  44.484386
ULYMAP            =  44.484386
XDIM              =  0.00001224
                                                                       
YDIM              =  0.00000901
XDIM              =  0.00001224  
NumOfCellsPerLine  =  1028
                                                                           
YDIM              =  0.00000901  
                                                                         
NumOfCellsPerLine  =  1028  
                                                                                 
NumOfLines        =  1028
NumOfLines        =  1028
                                                                                     
SourceDir          = "C:Mesh_Repair"
SourceDir          = "C:Mesh_Repair"
                                                                 
SourceFile        = "x.dem"
SourceFile        = "x.dem"
ScaleinMeters      =  1.0
                                                                                     
ScaleinMeters      =  1.0  
                                                                                                                                       
NullCellValue      =  0
NullCellValue      =  0
                                                                               
[Destination]
[Destination]
DestDir            = "C:Mesh_Repair"
DestDir            = "C:Mesh_Repair"
                                                           
DestBaseFileName  = "smooth"
DestBaseFileName  = "smooth"
DestFileType      =  BGL
                                                                                                                 
LOD                =  Auto
DestFileType      =  BGL  
UseSourceDimensions=  1
                                                                               
LOD                =  Auto  
                                                                         
UseSourceDimensions=  1                                                                                      




You will need to modify the following lines to produce  
You will need to modify the following lines to produce your specific scenery:  
your specific scenery:  


ULXMAP            Western  Longitude value of bitmap.
ULXMAP            Western  Longitude value of bitmap.
ULYMAP            Northern Latitude  value of bitmap.
ULYMAP            Northern Latitude  value of bitmap.
NumOfCellsPerLine number of x pixels      in bitmap.
NumOfCellsPerLine number of x pixels      in bitmap.
NumOfLines        number of y pixels      in bitmap.
NumOfLines        number of y pixels      in bitmap.
YDIM  = (North Latitude–South Latitude)/NumOfLines  
 
YDIM  = (North Latitude–South Latitude)/NumOfLines
XDIM  = (West Longitude  – East Longitude)/NumOfCellsPerLine
XDIM  = (West Longitude  – East Longitude)/NumOfCellsPerLine
NullCellValue  = 0
NullCellValue  = 0
              
              
            this allows you to
this allows you to
   
   
(a) reduce the bgl size by not generating a mesh surface altitude  
(a) reduce the bgl size by not generating a mesh surface altitude  
    when cell values (pixels) are 0 in (the example) bitmap.  
when cell values (pixels) are 0 in (the example) bitmap.  
      The value need not be zero.   
The value need not be zero.   
(b) eliminates from view the rectangular unnatural flat surface  
(b) eliminates from view the rectangular unnatural flat surface  
    which will occur at the corners of the bitmap  
which will occur at the corners of the bitmap  
      if one (wisely) chooses not to extend the contours directly  
if one (wisely) chooses not to extend the contours directly  
      to the edge of the bitmap.
to the edge of the bitmap.




Line 69: Line 106:
Add this text file and save it as x.bat  
Add this text file and save it as x.bat  


                      grises50 x.raw x.dem 1 0
grises50 x.raw x.dem 1 0
                      pause
 
                      resample x.inf
pause
                      pause
 
                      x.raw is the name of the bitmap
resample x.inf
                      x.dem is the resultant DEM file
 
pause
 
REM x.raw is the name of the bitmap
 
REM x.dem is the resultant DEM file
 
The 1 tells grises50 that every incremental increase of 1 in the
The 1 tells grises50 that every incremental increase of 1 in the
value of a grayscale pixel value means the mesh is 1 meter higher at that location.  
value of a grayscale pixel value means the mesh is 1 meter higher at that location.  
Line 85: Line 128:
Note: Consider using a grayscale bitmap with the contour levels defined with various grayscale values defined totally inside a surrounding field of grayscale pixels with a JET BLACK value of (rgb=0,0,0).  
Note: Consider using a grayscale bitmap with the contour levels defined with various grayscale values defined totally inside a surrounding field of grayscale pixels with a JET BLACK value of (rgb=0,0,0).  


This way you can define any minimum altitude with absolute certainty (no rogue pixels to corrupt your minimum altitude definition) and use the NullCellValue = (any positive integer) in the inf file to eliminate the minimum values from the bgl file produced.  
Reserving JET BLACK as a grayscale value that completely surrounds your desired surface allows you to use the NullCellValue = 0 in the inf file to eliminate the unwanted flat surface from the bgl file produced.  
 




All that remains now is producing a color contour topography map and converting a copy of it to a separate grayscale bitmap in raw format. This is where the real work is done. MNake sure the pipeline works by generating some experimental grayscale image to familiarize yourself with the process.  
All that remains now is producing a color contour topography map and converting a copy of it to a separate grayscale bitmap in raw format. This is where the real work is done. Make sure the pipeline works by generating some experimental grayscale image to familiarize yourself with the process.  





Latest revision as of 06:55, 18 June 2014


(a) install the FSX SDK installed on your system.

(b) download grises50 by Jokin BediaLauneta from http://users.skynet.be/maximil/grises50exe.zip and unzip it to whatever folder the system chooses.

(c) create a folder called Mesh_Repair on your C drive, and place a shortcut to this folder on your desktop.

(d) copy the unzipped grises50 executable into Mesh_Repair.

(e) add the following shortcuts to Mesh_Repair:

to FSX to start the simulator,

to your Addon scenery folder,

to the resample program in your FSX SDK

to the tmfviewer in your FSX SDK


Add the following text file and save it as x.inf:

[Source]

Type = ElevS16LSB

Layer = Elevation

ULXMAP = -73.172208

ULYMAP = 44.484386

XDIM = 0.00001224

YDIM = 0.00000901

NumOfCellsPerLine = 1028

NumOfLines = 1028

SourceDir = "C:Mesh_Repair"

SourceFile = "x.dem"

ScaleinMeters = 1.0

NullCellValue = 0

[Destination]

DestDir = "C:Mesh_Repair"

DestBaseFileName = "smooth"

DestFileType = BGL

LOD = Auto

UseSourceDimensions= 1


You will need to modify the following lines to produce your specific scenery:

ULXMAP Western Longitude value of bitmap.

ULYMAP Northern Latitude value of bitmap.

NumOfCellsPerLine number of x pixels in bitmap.

NumOfLines number of y pixels in bitmap.

YDIM = (North Latitude–South Latitude)/NumOfLines

XDIM = (West Longitude – East Longitude)/NumOfCellsPerLine

NullCellValue = 0

this allows you to

(a) reduce the bgl size by not generating a mesh surface altitude when cell values (pixels) are 0 in (the example) bitmap. The value need not be zero. (b) eliminates from view the rectangular unnatural flat surface which will occur at the corners of the bitmap if one (wisely) chooses not to extend the contours directly to the edge of the bitmap.


Add this text file and save it as x.bat

grises50 x.raw x.dem 1 0

pause

resample x.inf

pause

REM x.raw is the name of the bitmap

REM x.dem is the resultant DEM file

The 1 tells grises50 that every incremental increase of 1 in the value of a grayscale pixel value means the mesh is 1 meter higher at that location.

Note: This value must be an integer. Note: It follows that the range of mesh altitudes possible when the parameter value here equals 1 is 256 meters and is the most accurate definition of surfaces possible.

The 0 defines the minimum altitude in meters that the lowest grayscale value found in the bitmap represents. It can be any integral value. In this case it is at sealevel.

Note: Consider using a grayscale bitmap with the contour levels defined with various grayscale values defined totally inside a surrounding field of grayscale pixels with a JET BLACK value of (rgb=0,0,0).

Reserving JET BLACK as a grayscale value that completely surrounds your desired surface allows you to use the NullCellValue = 0 in the inf file to eliminate the unwanted flat surface from the bgl file produced.


All that remains now is producing a color contour topography map and converting a copy of it to a separate grayscale bitmap in raw format. This is where the real work is done. Make sure the pipeline works by generating some experimental grayscale image to familiarize yourself with the process.


To produce a bgl file from an x.raw grayscale file:

Double click on the batchfile and step completely through it as directed. It will show raw-to-dem intermediate results.

A bgl file should appear in a few seconds.

Drag the bgl file to tmfviewer and set the elevation color levels to check the contour levels for accuracy.

When it looks reasonable drag the bgl file to the Addon scenery folder shortcut then doubleclick on the FSX shortcut and proceed to admire your work.






These guidelines are useful for Paint Shop Pro users.

Work in a PSP color format until one is completely satisfied with the image. Make your adjustments there. It is impossible to create a grayscale image from scratch without risking your sanity.

Put your topography guide on level 1 and draw your contour map on a separate level colored white and 50% transparent.

Play it safe and use square bitmaps with x and y dimensions of 257 or integral multiples of 257.

Someone may want to expand our understanding here.

It appears (to me) that (sometimes) grises50 does not like rectangles with random dimensions. It manifests this by producing just a few altitude levels and notifying you of such in the standard (Portuguese) readout.

Right from the beginning embed the x and y pixel size in all filenames, because there is no header information in a raw file and at first, Paint Shop Pro might ask for the dimensions when you reload the image.

Forgetting them after investing a lot of effort won’t feel good.

Make a copy of your psp file, and repaint the copy with grayscale values, save it then convert it to a raw grayscale planar file called x.raw.