Custom DEM creation with grises50
From FSDeveloper Wiki
(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
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
DestDir = "C:Mesh_Repair"
DestBaseFileName = "smooth"
DestFileType = BGL
LOD = Auto
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
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.
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.
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.